Part Number Hot Search : 
W83321G EZQAFDA BA2107G M3L24TCN PDTC1 AM27C010 MPS2810 CUN8AF1A
Product Description
Full Text Search
 

To Download ST72T311J4B3S Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  may 2001 1/101 st72e311 st72t311 8-bit mcu with 8 to 16k otp/eprom, 384 to 512 bytes ram, adc, wdg, sci, spi and 2 timers datasheet n user program memory (otp/eprom): 8 to 16k bytes n data ram: 384 to 512 bytes including 256 bytes of stack n master reset and power-on reset n low voltage detector reset option n run and power saving modes n 44 or 32 multifunctional bidirectional i/o lines: C 15 or 9 programmable interrupt inputs C 8 or 4 high sink outputs C 8 or 6 analog alternate inputs C 13 alternate functions Cemi filtering n software or hardware watchdog (wdg) n two 16-bit timers, each featuring: C 2 input captures 1) C 2 output compares 1) C external clock input (on timer a) C pwm and pulse generator modes n synchronous serial peripheral interface (spi) n asynchronous serial communications interface (sci) n 8-bit adc with 8 channels 2) n 8-bit data manipulation n 63 basic instructions and 17 main addressing modes n 8 x 8 unsigned multiply instruction n true bit manipulation n complete development support on dos/ windows tm real-time emulator n full software package on dos/windows tm (c-compiler, cross-assembler, debugger) notes: 1. one only on timer a. 2. six channels only for st72t311j. device summary note: the rom versions are supported by the st72314 family. tqfp44 psdip42 psdip56 csdip42w csdip56w tqfp64 (see ordering information at the end of datasheet) features st72t311j2 st72t311j4 st72t311n2 st72t311n4 program memory - bytes 8k 16k 8k 16k ram (stack) - bytes 384 (256) 512 (256) 384 (256) 512 (256) peripherals watchdog, timers, spi, sci, adc and optional low voltage detector reset operating supply 3 to 5.5 v cpu frequency 8mhz max (16mhz oscillator) - 4mhz max over 85c temperature range - 40c to + 125c package tqfp44 - sdip42 tqfp64 - sdip56 1 rev. 1.8
2/101 table of contents 101 1 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 external connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.5 option byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2 central processing unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3 clocks, reset, interrupts & power saving modes . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1 clock system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1.1 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1.2 external clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2.2 external reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 8 3.2.3 reset operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2.4 low voltage detector reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.1 non maskable software interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.2 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.3 peripheral interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.4 power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.2 slow mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.3 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.4.4 halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.5 miscellaneous register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5 on-chip peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1 i/o ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1.2 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 5.1.3 i/o port implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.1.4 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.2 watchdog timer (wdg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.2.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.2.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 5.2.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.2.4 hardware watchdog option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2.5 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2.6 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2.7 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.3 16-bit timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.3.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.3.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 5 5.3.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.3.4 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.3.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2
3/101 table of contents 5.3.6 summary of timer modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.3.7 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.4 serial communications interface (sci) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.4.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.4.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 5.4.3 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.4.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.4.5 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.4.6 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 5.4.7 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 5.5 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.5.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.5.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 5.5.3 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.5.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.5.5 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 5.5.6 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 5.5.7 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 5.6 8-bit a/d converter (adc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.6.1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.6.2 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8 5.6.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.6.4 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.6.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.6.6 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6 instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 6.1 st7 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 6.1.1 inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.1.2 immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.1.3 direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.1.4 indexed (no offset, short, long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.1.5 indirect (short, long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.1.6 indirect indexed (short, long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 6.1.7 relative mode (direct, indirect) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 6.2 instruction groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2 recommended operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7.3 dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 7.4 reset characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.5 oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 7.6 peripheral characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 8 general information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 8.1 eprom erasure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6 8.2 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.3 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 9 summary of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1 3
4/101 st72e311 st72t311 1 general description 1.1 introduction the st72t311 hcmos microcontroller unit (mcu) is a member of the st7 family. the device is based on an industry-standard 8-bit core and features an enhanced instruction set. the device is normally operated at a 16 mhz oscillator fre- quency. under software control, the st72t311 may be placed in either wait, slow or halt modes, thus reducing power consumption. the enhanced instruction set and addressing modes afford real programming potential. in addition to standard 8-bit data management, the st72t311 features true bit manipulation, 8x8 unsigned multiplication and indirect addressing modes on the whole mem- ory. the device includes a low consumption and fast start on-chip oscillator, cpu, program memo- ry (otp/eprom versions), ram, 44 (st72t311n) or 32 (st72t311j) i/o lines, a low voltage detector (lvd) and the following on-chip peripherals: analog-to-digital converter (adc) with 8 (st72t311n) or 6 (st72t311j) multiplexed analog inputs, industry standard synchronous spi and asynchronous sci serial interfaces, digital watchdog, two independent 16-bit timers, one featuring an external clock input, and both featur- ing pulse generator capabilities, 2 input captures and 2 output compares (only 1 input capture and 1 output compare on timer a). figure 1. st72t311 block diagram 8-bit core alu address and data bus oscin oscout reset port b timer b port c spi port e sci port d 8-bit adc watchdog pb0 -> pb7 pc0 -> pc7 pe0 -> pe7 pd0 -> pd7 osc internal clock control ram (384 - 512 bytes) port f pf0 -> pf2,4,6,7 timer a port a pa0 -> pa7 v ssa v dda (6 bits for st72t311n) (6 bits) and lvd (2 bits for st72t311j) (8 bits for st72t311n) (6 bits for st72t311j) (8 bits for st72t311n) (5 bits for st72t311j) (8 bits) (8 bits for st72t311n) (5 bits for st72t311j) v ss v dd power supply program (8 - 16k bytes) memory 4
5/101 st72e311 st72t311 1.2 pin description figure 2. 64-pin thin qfp package pinout figure 3. 56-pin shrink dip package pinout figure 4. 44-pin thin qfp package pinout figure 5. 42-pin shrink dip package pinout 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 17 18 19 20 21 22 23 24 29 30 31 32 25 26 27 28 pe4 pe5 pe6 pe7 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 ain0/pd0 ain1/pd1 ain2/pd2 ain3/pd3 v ss_1 v dd_1 pa3 pa2 pa1 pa0 pc7/ss pc6/sck pc5/mosi pc4/miso pc3/icap1_b pc2/icap2_b pc1/ocmp1_b pc0/ocmp2_b v ss_0 v dd_0 ain4/pd4 ain5/pd5 ain6/pd6 ain7/pd7 v dda v ssa v dd_3 v ss_3 clkout/pf0 pf1 pf2 nc ocmp1_a/pf4 nc icap1_a/pf6 extclk_a/pf7 nc nc pe1/rdi pe0/tdo v dd_2 oscin oscout v ss_2 nc nc reset test/v pp 1) pa7 pa6 pa5 pa4 (ei0) (ei0) (ei0) (ei0) (ei2) (ei2) (ei2) (ei2) (ei3) (ei3) (ei3) (ei3) (ei1) (ei1) (ei1) 1. v pp on eprom/otp only 15 (ei1) 16 (ei1) 17 (ei1) 18 19 20 21 22 23 24 25 26 27 28 29 30 (ei0) 31 (ei0) 32 (ei0) 33 (ei0) 34 clkout/pf0 pf1 pf2 ocmp1_a/pf4 icap1_a/pf6 pc1/ocmp1_b pc2/icap2_b extclk_a/pf7 v dd_0 v ss_0 reset test/v pp 1) pa7 pa6 pa5 pa2 pa1 pa0 pc7/ss pc6/sck 42 41 40 39 38 37 36 35 pc0/ocmp2_b pc3/icap1_b pc4/miso pc5/mosi pa4 v ss_1 v dd_1 pa3 1 (ei3) 2 (ei3) 3 (ei3) 4 (ei3) 5 6 7 8 9 10 11 12 13 14 43 44 45 46 47 48 pb4 pb5 pb6 pb7 ain0/pd0 ain5/pd5 ain6/pd6 ain1/pd1 ain2/pd2 ain3/pd3 pb3 pb2 pb1 pb0 pe7 pe0/td0 v dd_2 oscin oscout v ss_2 (ei2) 56 (ei2) 55 (ei2) 54 (ei2) 53 52 51 50 49 ain4/pd4 ain7/pd7 v dda v ssa pe6 pe5 pe4 pe1/rdi 1. v pp on eprom/otp only 1 2 3 4 5 6 7 8 9 10 11 33 32 31 30 29 28 27 26 25 24 23 44 43 42 41 40 39 38 37 36 35 34 12 13 14 15 16 17 18 19 (ei1) (ei1) (ei1) 20 21 22 clkout/pf0 pf1 pf2 ocmp1_a/pf4 icap1_a/pf6 pc1/ocmp1_b pc2/icap2_b extclk_a/pf7 v dd_0 v ss_0 pc0/ocmp2_b pc3/icap1_b pc4/miso pc5/mosi pb4 ain0/pd0 ain5/pd5 ain1/pd1 ain2/pd2 ain3/pd3 ain4/pd4 v dda v ssa reset test/v pp 1) pa7 pa6 pa5 pc7/ss pc6/sck pa4 v ss_1 v dd_1 pa3 pb3 pb2 pb1 pb0 pe0/td0 v dd_2 oscin oscout v ss_2 pe1/rdi (ei3) (ei2) (ei2) (ei2) (ei2) (ei0) 1. v pp on eprom/otp only 15 16 17 18 19 20 21 clkout/pf0 pf1 pf2 ocmp1_a/pf4 icap1_a/pf6 pc1/ocmp1_b pc2/icap2_b extclk_a/pf7 reset test/v pp 1) pa7 pa6 pa5 pc7/ss pc6/sck 28 27 26 25 24 23 22 pc0/ocmp2_b pc3/icap1_b pc4/miso pc5/mosi pa4 v ss_1 v dd_1 pa3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 29 30 31 32 33 34 pb4 ain0/pd0 ain5/pd5 ain1/pd1 ain2/pd2 ain3/pd3 pb3 pb2 pb1 pb0 pe0/td0 v dd_2 oscin oscout v ss_2 42 41 40 39 38 37 36 35 ain4/pd4 v dda v ssa pe1/rdi (ei3) (ei1) (ei1) (ei1) (ei0) (ei2) (ei2) (ei2) (ei2) 1. v pp on eprom/otp only 5
6/101 st72e311 st72t311 table 1. st72t311nx pin description pin n qfp64 pin n sdip56 pin name type description remarks 1 49 pe4 i/o port e4 high sink 2 50 pe5 i/o port e5 high sink 3 51 pe6 i/o port e6 high sink 4 52 pe7 i/o port e7 high sink 5 53 pb0 i/o port b0 external interrupt: ei2 6 54 pb1 i/o port b1 external interrupt: ei2 7 55 pb2 i/o port b2 external interrupt: ei2 8 56 pb3 i/o port b3 external interrupt: ei2 9 1 pb4 i/o port b4 external interrupt: ei3 10 2 pb5 i/o port b5 external interrupt: ei3 11 3 pb6 i/o port b6 external interrupt: ei3 12 4 pb7 i/o port b7 external interrupt: ei3 13 5 pd0/ain0 i/o port d0 or adc analog input 0 14 6 pd1/ain1 i/o port d1 or adc analog input 1 15 7 pd2/ain2 i/o port d2 or adc analog input 2 16 8 pd3/ain3 i/o port d3 or adc analog input 3 17 9 pd4/ain4 i/o port d4 or adc analog input 4 18 10 pd5/ain5 i/o port d5 or adc analog input 5 19 11 pd6/ain6 i/o port d6 or adc analog input 6 20 12 pd7/ain7 i/o port d7 or adc analog input 7 21 13 v dda s power supply for analog peripheral (adc) 22 14 v ssa s ground for analog peripheral (adc) 23 v dd_3 s main power supply 24 v ss_3 s ground 25 15 pf0/clkout i/o port f0 or cpu clock output external interrupt: ei1 26 16 pf1 i/o port f1 external interrupt: ei1 27 17 pf2 i/o port f2 external interrupt: ei1 28 nc not connected 29 18 pf4/ocmp1_a i/o port f4 or timer a output compare 1 30 nc not connected 31 19 pf6/icap1_a i/o port f6 or timer a input capture 1 32 20 pf7/extclk_a i/o port f7 or external clock on timer a 33 21 v dd_0 s main power supply 34 22 v ss_0 s ground 35 23 pc0/ocmp2_b i/o port c0 or timer b output compare 2 36 24 pc1/ocmp1_b i/o port c1 or timer b output compare 1 37 25 pc2/icap2_b i/o port c2 or timer b input capture 2 38 26 pc3/icap1_b i/o port c3 or timer b input capture 1 39 27 pc4/miso i/o port c4 or spi master in / slave out data 40 28 pc5/mosi i/o port c5 or spi master out / slave in data 41 29 pc6/sck i/o port c6 or spi serial clock 42 30 pc7/ss i/o port c7 or spi slave select 43 31 pa0 i/o port a0 external interrupt: ei0 44 32 pa1 i/o port a1 external interrupt: ei0 6
7/101 st72e311 st72t311 note 1: v pp on eprom/otp only. table 2. st72t311jx pin description 45 33 pa2 i/o port a2 external interrupt: ei0 46 34 pa3 i/o port a3 external interrupt: ei0 47 35 v dd_1 s main power supply 48 36 v ss_1 s ground 49 37 pa4 i/o port a4 high sink 50 38 pa5 i/o port a5 high sink 51 39 pa6 i/o port a6 high sink 52 40 pa7 i/o port a7 high sink 53 41 test/v pp 1) s test mode pin. in the eprom programming mode, this pin acts as the programming voltage input v pp. this pin must be tied low in user mode 54 42 reset i/o bidirectional. active low. top priority non maskable interrupt. 55 nc not connected 56 nc not connected 57 43 v ss_2 s ground 58 44 oscout o input/output oscillator pin. these pins connect a parallel-resonant crystal, or an external source to the on-chip oscillator. 59 45 oscin i 60 46 v dd_2 s main power supply 61 47 pe0/tdo i/o port e1 or sci transmit data out 62 48 pe1/rdi i/o port e1 or sci receive data in 63 nc not connected 64 nc not connected pin n qfp64 pin n sdip56 pin name type description remarks pin n qfp44 pin n sdip42 pin name type description remarks 1 38 pe1/rdi i/o port e1 or sci receive data in 2 39 pb0 i/o port b0 external interrupt: ei2 3 40 pb1 i/o port b1 external interrupt: ei2 4 41 pb2 i/o port b2 external interrupt: ei2 5 42 pb3 i/o port b3 external interrupt: ei2 6 1 pb4 i/o port b4 external interrupt: ei3 7 2 pd0/ain0 i/o port d0 or adc analog input 0 8 3 pd1/ain1 i/o port d1 or adc analog input 1 9 4 pd2/ain2 i/o port d2 or adc analog input 2 10 5 pd3/ain3 i/o port d3 or adc analog input 3 11 6 pd4/ain4 i/o port d4 or adc analog input 4 12 7 pd5/ain5 i/o port d5 or adc analog input 5 13 8 v dda s power supply for analog peripheral (adc) 14 9 v ssa s ground for analog peripheral (adc) 15 10 pf0/clkout i/o port f0 or cpu clock output external interrupt: ei1 16 11 pf1 i/o port f1 external interrupt: ei1 17 12 pf2 i/o port f2 external interrupt: ei1 18 13 pf4/ocmp1_a i/o port f4 or timer a output compare 1 7
8/101 st72e311 st72t311 note 1: v pp on eprom/otp only. 19 14 pf6/icap1_a i/o port f6 or timer a input capture 1 20 15 pf7/extclk_a i/o port f7 or external clock on timer a 21 v dd_0 s main power supply 22 v ss_0 s ground 23 16 pc0/ocmp2_b i/o port c0 or timer b output compare 2 24 17 pc1/ocmp1_b i/o port c1 or timer b output compare 1 25 18 pc2/icap2_b i/o port c2 or timer b input capture 2 26 19 pc3/icap1_b i/o port c3 or timer b input capture 1 27 20 pc4/miso i/o port c4 or spi master in / slave out data 28 21 pc5/mosi i/o port c5 or spi master out / slave in data 29 22 pc6/sck i/o port c6 or spi serial clock 30 23 pc7/ss i/o port c7 or spi slave select 31 24 pa3 i/o port a3 external interrupt: ei0 32 25 v dd_1 s main power supply 33 26 v ss_1 s ground 34 27 pa4 i/o port a4 high sink 35 28 pa5 i/o port a5 high sink 36 29 pa6 i/o port a6 high sink 37 30 pa7 i/o port a7 high sink 38 31 test/v pp 1) s test mode pin. in the eprom programming mode, this pin acts as the programming voltage input v pp. this pin must be tied low in user mode 39 32 reset i/o bidirectional. active low. top priority non maskable interrupt. 40 33 v ss_2 s ground 41 34 oscout o input/output oscillator pin. these pins connect a parallel-resonant crystal, or an external source to the on-chip oscillator. 42 35 oscin i 43 36 v dd_2 s main power supply 44 37 pe0/tdo i/o port e0 or sci transmit data out pin n qfp44 pin n sdip42 pin name type description remarks 8
9/101 st72e311 st72t311 1.3 external connections the following figure shows the recommended ex- ternal connections for the device. the v pp pin is only used for programming otp and eprom devices and must be tied to ground in user mode. the 10 nf and 0.1 f decoupling capacitors on the power supply lines are a suggested emc per- formance/cost tradeoff. the external reset network is intended to protect the device against parasitic resets, especially in noisy environments. unused i/os should be tied high to avoid any un- necessary power consumption on floating lines. an alternative solution is to program the unused ports as inputs with pull-up. figure 6. recommended external connections v pp v dd v ss oscin oscout reset v dd 0.1f + see clocks section v dd 0.1f 0.1f external reset circuit or configure unused i/o ports unused i/o 10nf 4.7k 10k by software as input with pull-up v dd v dda v ssa see a/d converter section detector (lvd) is used optional if low voltage 9
10/101 st72e311 st72t311 1.4 memory map figure 7. program memory map table 3. interrupt vector map vector address description remarks ffe0-ffe1h ffe2-ffe3h ffe4-ffe5h ffe6-ffe7h ffe8-ffe9h ffea-ffebh ffec-ffedh ffee-ffefh fff0-fff1h fff2-fff3h fff4-fff5h fff6-fff7h fff8-fff9h fffa-fffbh fffc-fffdh fffe-ffffh not used not used not used sci interrupt vector timer b interrupt vector timer a interrupt vector spi interrupt vector not used external interrupt vector ei3 external interrupt vector ei2 external interrupt vector ei1 external interrupt vector ei0 not used not used trap (software) interrupt vector reset vector internal interrupt internal interrupt internal interrupt internal interrupt internal interrupt external interrupt external interrupt external interrupt external interrupt cpu interrupt 0000h interrupt & reset vectors hw registers 027fh 0080h short addressing ram (zero page) 16-bit addressing ram 007fh 0200h / 0280h reserved 0080h (see table 4 ) ffdfh ffe0h ffffh (see table 3 ) 027fh c000h bfffh 00ffh 0100h 01ffh 0200h 8k bytes e000h 16k bytes program short addressing ram (zero page) 0080h 00ffh 01ffh 01ffh 384 bytes ram 512 bytes ram 256 bytes stack/ 16-bit addressing ram 256 bytes stack/ 16-bit addressing ram 0100h memory program memoryl 10
11/101 st72e311 st72t311 table 4. hardware register memory map address block register label register name reset status remarks 0000h 0001h 0002h port a padr paddr paor data register data direction register option register 00h 00h 00h r/w r/w r/w 1) 0003h reserved area (1 byte) 0004h 0005h 0006h port c pcdr pcddr pcor data register data direction register option register 00h 00h 00h r/w r/w r/w 0007h reserved area (1 byte) 0008h 0009h 000ah port b pbdr pbddr pbor data register data direction register option register 00h 00h 00h r/w r/w r/w 1) 000bh reserved area (1 byte) 000ch 000dh 000eh port e pedr peddr peor data register data direction register option register 00h 00h 0ch r/w r/w r/w 1) 000fh reserved area (1 byte) 0010h 0011h 0012h port d pddr pdddr pdor data register data direction register option register 00h 00h 00h r/w r/w r/w 1) 0013h reserved area (1 byte) 0014h 0015h 0016h port f pfdr pfddr pfor data register data direction register option register 00h 00h 28h r/w r/w r/w 1) 0017h to 001fh reserved area (9 bytes) 0020h miscr miscellaneous register 00h 0021h 0022h 0023h spi spidr spicr spisr spi data i/o register spi control register spi status register xxh xxh 00h r/w r/w read only 0024h to 0029h reserved area (6 bytes) 002ah 002bh wdg wdgcr wdgsr watchdog control register watchdog status register 7fh 00h r/w r/w 3) 002ch to 0030h reserved area (5 bytes) 11
12/101 st72e311 st72t311 notes: 1. the bits corresponding to unavailable pins are forced to 1 by hardware, this affects the reset status value. 2. external pin not available. 3. not used in versions without low voltage detector reset. 0031h 0032h 0033h 0034h-0035h 0036h-0037h 0038h-0039h 003ah-003bh 003ch-003dh 003eh-003fh timer a tacr2 tacr1 tasr taic1hr taic1lr taoc1hr taoc1lr tachr taclr taachr taaclr taic2hr taic2lr taoc2hr taoc2lr control register2 control register1 status register input capture1 high register input capture1 low register output compare1 high register output compare1 low register counter high register counter low register alternate counter high register alternate counter low register input capture2 high register input capture2 low register output compare2 high register output compare2 low register 00h 00h xxh xxh xxh 80h 00h ffh fch ffh fch xxh xxh 80h 00h r/w r/w read only read only read only r/w r/w read only read only read only read only read only 2) read only 2) r/w 2) r/w 2) 0040h reserved area (1 byte) 0041h 0042h 0043h 0044h-0045h 0046h-0047h 0048h-0049h 004ah-004bh 004ch-004dh 004eh-004fh timer b tbcr2 tbcr1 tbsr tbic1hr tbic1lr tboc1hr tboc1lr tbchr tbclr tbachr tbaclr tbic2hr tbic2lr tboc2hr tboc2lr control register2 control register1 status register input capture1 high register input capture1 low register output compare1 high register output compare1 low register counter high register counter low register alternate counter high register alternate counter low register input capture2 high register input capture2 low register output compare2 high register output compare2 low register 00h 00h xxh xxh xxh 80h 00h ffh fch ffh fch xxh xxh 80h 00h r/w r/w read only read only read only r/w r/w read only read only read only read only read only read only r/w r/w 0050h 0051h 0052h 0053h 0054h 0055h 0056h 0057h sci scisr scidr scibrr scicr1 scicr2 scierpr scietpr sci status register sci data register sci baud rate register sci control register 1 sci control register 2 sci extended receive prescaler register reserved sci extended transmit prescaler register c0h xxh 00x----xb xxh 00h 00h --- 00h read only r/w r/w r/w r/w r/w reserved r/w 0058h to 006fh reserved area (24 bytes) 0070h 0071h adc adcdr adccsr adc data register adc control/status register 00h 00h read only r/w 0072h to 007fh reserved area (14 bytes) address block register label register name reset status remarks 12
13/101 st72e311 st72t311 1.5 option byte the user has the option to select software watch- dog or hardware watchdog (see description in the watchdog chapter). when programming eprom or otp devices, this option is selected in a menu by the user of the eprom programmer before burning the eprom/otp. the option byte is lo- cated in a non-user map. no address has to be specified. the option byte is at ffh after uv eras- ure and must be properly programmed to set de- sired options. optbyte bit 7:4 = not used bit 3 = reserved, must be cleared. bit 2 = reserved, must be set on st72t311n de- vices and must be cleared on st72t311j devices. bit 1 = not used bit 0 = wdg watchdog disable 0: the watchdog is enabled after reset (hardware watchdog). 1: the watchdog is not enabled after reset (soft- ware watchdog). 70 - - - - b3 b2 - wdg 13
14/101 st72e311 st72t311 2 central processing unit 2.1 introduction this cpu has a full 8-bit architecture and contains six internal registers allowing efficient 8-bit data manipulation. 2.2 main features n 63 basic instructions n fast 8-bit by 8-bit multiply n 17 main addressing modes n two 8-bit index registers n 16-bit stack pointer n low power modes n maskable hardware interrupts n non-maskable software interrupt 2.3 cpu registers the 6 cpu registers shown in figure 1 are not present in the memory mapping and are accessed by specific instructions. accumulator (a) the accumulator is an 8-bit general purpose reg- ister used to hold operands and the results of the arithmetic and logic calculations and to manipulate data. index registers (x and y) in indexed addressing modes, these 8-bit registers are used to create either effective addresses or temporary storage areas for data manipulation. (the cross-assembler generates a precede in- struction (pre) to indicate that the following in- struction refers to the y register.) the y register is not affected by the interrupt auto- matic procedures (not pushed to and popped from the stack). program counter (pc) the program counter is a 16-bit register containing the address of the next instruction to be executed by the cpu. it is made of two 8-bit registers pcl (program counter low which is the lsb) and pch (program counter high which is the msb). figure 8. cpu registers accumulator x index register y index register stack pointer condition code register program counter 70 1c 11hi nz reset value = reset vector @ fffeh-ffffh 70 70 70 0 7 15 8 pch pcl 15 8 70 reset value = stack higher address reset value = 1x 11x1xx reset value = xxh reset value = xxh reset value = xxh x = undefined value 14
15/101 st72e311 st72t311 cpu registers (contd) condition code register (cc) read/write reset value: 111x1xxx the 8-bit condition code register contains the in- terrupt mask and four flags representative of the result of the instruction just executed. this register can also be handled by the push and pop in- structions. these bits can be individually tested and/or con- trolled by specific instructions. bit 4 = h half carry . this bit is set by hardware when a carry occurs be- tween bits 3 and 4 of the alu during an add or adc instruction. it is reset by hardware during the same instructions. 0: no half carry has occurred. 1: a half carry has occurred. this bit is tested using the jrh or jrnh instruc- tion. the h bit is useful in bcd arithmetic subrou- tines. bit 3 = i interrupt mask . this bit is set by hardware when entering in inter- rupt or by software to disable all interrupts except the trap software interrupt. this bit is cleared by software. 0: interrupts are enabled. 1: interrupts are disabled. this bit is controlled by the rim, sim and iret in- structions and is tested by the jrm and jrnm in- structions. note: interrupts requested while i is set are latched and can be processed when i is cleared. by default an interrupt routine is not interruptable because the i bit is set by hardware at the start of the routine and reset by the iret instruction at the end of the routine. if the i bit is cleared by software in the interrupt routine, pending interrupts are serviced regardless of the priority level of the cur- rent interrupt routine. bit 2 = n negative . this bit is set and cleared by hardware. it is repre- sentative of the result sign of the last arithmetic, logical or data manipulation. it is a copy of the 7 th bit of the result. 0: the result of the last operation is positive or null. 1: the result of the last operation is negative (i.e. the most significant bit is a logic 1). this bit is accessed by the jrmi and jrpl instruc- tions. bit 1 = z zero . this bit is set and cleared by hardware. this bit in- dicates that the result of the last arithmetic, logical or data manipulation is zero. 0: the result of the last operation is different from zero. 1: the result of the last operation is zero. this bit is accessed by the jreq and jrne test instructions. bit 0 = c carry/borrow. this bit is set and cleared by hardware and soft- ware. it indicates an overflow or an underflow has occurred during the last arithmetic operation. 0: no overflow or underflow has occurred. 1: an overflow or underflow has occurred. this bit is driven by the scf and rcf instructions and tested by the jrc and jrnc instructions. it is also affected by the bit test and branch, shift and rotate instructions. 70 111hinzc 15
16/101 st72e311 st72t311 central processing unit (contd) stack pointer (sp) read/write reset value: 01ffh the stack pointer is a 16-bit register which is al- ways pointing to the next free location in the stack. it is then decremented after data has been pushed onto the stack and incremented before data is popped from the stack (see figure 9 ). since the stack is 256 bytes deep, the 8th most significant bits are forced by hardware. following an mcu reset, or after a reset stack pointer in- struction (rsp), the stack pointer contains its re- set value (the sp7 to sp0 bits are set) which is the stack higher address. the least significant byte of the stack pointer (called s) can be directly accessed by a ld in- struction. note: when the lower limit is exceeded, the stack pointer wraps around to the stack upper limit, with- out indicating the stack overflow. the previously stored information is then overwritten and there- fore lost. the stack also wraps in case of an under- flow. the stack is used to save the return address dur- ing a subroutine call and the cpu context during an interrupt. the user may also directly manipulate the stack by means of the push and pop instruc- tions. in the case of an interrupt, the pcl is stored at the first location pointed to by the sp. then the other registers are stored in the next locations as shown in figure 9 . C when an interrupt is received, the sp is decre- mented and the context is pushed on the stack. C on return from interrupt, the sp is incremented and the context is popped from the stack. a subroutine call occupies two locations and an in- terrupt five locations in the stack area. figure 9. stack manipulation example 15 8 00000001 70 sp7 sp6 sp5 sp4 sp3 sp2 sp1 sp0 pch pcl sp pch pcl sp pcl pch x a cc pch pcl sp pcl pch x a cc pch pcl sp pcl pch x a cc pch pcl sp sp y call subroutine interrupt event push y pop y iret ret or rsp @ 01ffh @ 0100h stack higher address = 01ffh stack lower address = 0100h 16
17/101 st72e311 st72t311 3 clocks, reset, interrupts & power saving modes 3.1 clock system 3.1.1 general description the mcu accepts either a crystal or ceramic reso- nator, or an external clock signal to drive the inter- nal oscillator. the internal clock (f cpu ) is derived from the external oscillator frequency (f osc ) . the external oscillator clock is first divided by 2, and an additional division factor of 2, 4, 8, or 16 can be applied, in slow mode, to reduce the frequency of the f cpu ; this clock signal is also routed to the on- chip peripherals. the cpu clock signal consists of a square wave with a duty cycle of 50%. the internal oscillator is designed to operate with an at-cut parallel resonant quartz crystal resona- tor in the frequency range specified for f osc . the circuit shown in figure 11 is recommended when using a crystal, and table 5 lists the recommend- ed capacitance and feedback resistance values. the crystal and associated components should be mounted as close as possible to the input pins in order to minimize output distortion and start-up stabilisation time. use of an external cmos oscillator is recom- mended when crystals outside the specified fre- quency ranges are to be used. 3.1.2 external clock an external clock may be applied to the oscin in- put with the oscout pin not connected, as shown on figure 10 . table 5 recommended values for 16 mhz crystal resonator (c 0 < 7pf) r smax : parasitic series resistance of the quartz crystal (upper limit). c 0 : parasitic shunt capacitance of the quartz crys- tal (upper limit 7pf). c oscout , c oscin : maximum total capacitance on pins oscin and oscout (the value includes the external capacitance tied to the pin plus the para- sitic capacitance of the board and of the device). figure 10. external clock source connections figure 11. crystal/ceramic resonator figure 12. clock prescaler block diagram r smax 40 w 60 w 150 w c oscin 56pf 47pf 22pf c oscout 56pf 47pf 22pf oscin oscout external clock nc oscin oscout c oscin c oscout oscin oscout c oscin c oscout %2 % 2, 4, 8, 16 f cpu to cpu and peripherals 17
18/101 st72e311 st72t311 3.2 reset 3.2.1 introduction there are four sources of reset: C reset pin (external source) C power-on reset (internal source) C watchdog (internal source) C low voltage detection reset (internal source) the reset service routine vector is located at ad- dress fffeh-ffffh. 3.2.2 external reset the reset pin is both an input and an open-drain output with integrated pull-up resistor. when one of the internal reset sources is active, the reset pin is driven low for a duration of t reset to reset the whole application. 3.2.3 reset operation the duration of the reset state is a minimum of 4096 internal cpu clock cycles. during the reset state, all i/os take their reset value. a reset signal originating from an external source must have a duration of at least t pulse in order to be recognised. this detection is asynchronous and therefore the mcu can enter reset state even in halt mode. at the end of the reset cycle, the mcu may be held in the reset state by an external reset sig- nal. the reset pin may thus be used to ensure v dd has risen to a point where the mcu can oper- ate correctly before the user program is run. fol- lowing a reset event, or after exiting halt mode, a 4096 cpu clock cycle delay period is initiated in order to allow the oscillator to stabilise and to en- sure that recovery has taken place from the reset state. in the high state, the reset pin is connected in- ternally to a pull-up resistor (r on ). this resistor can be pulled low by external circuitry to reset the device. the reset pin is an asynchronous signal which plays a major role in ems performance. in a noisy environment, it is recommended to use the exter- nal connections shown in figure 6 . figure 13. reset block diagram internal reset watchdog reset oscillator signal counter reset to st7 reset power-on reset v dd low voltage detector reset r on 18
19/101 st72e311 st72t311 reset (contd) 3.2.4 low voltage detector reset the on-chip low voltage detector (lvd) gener- ates a static reset when the supply voltage is be- low a reference value. the lvd functions both during power-on as well as when the power supply drops (brown-out). the reference value for a volt- age drop is lower than the reference value for pow- er-on in order to avoid a parasitic reset when the mcu starts running and sinks current on the sup- ply (hysteresis). the lvd reset circuitry generates a reset when v dd is below: v lvdup when v dd is rising v lvddown when v dd is falling provided the minimun v dd value (guaranteed for the oscillator frequency) is above v lvddown , the mcu can only be in two modes: - under full software control or - in static safe reset in this condition, secure operation is always en- sured for the application without the need for ex- ternal reset hardware. during a low voltage detector reset, the reset pin is held low, thus permitting the mcu to reset other devices. in noisy environments, the power supply may drop for short periods and cause the low voltage de- tector to generate a reset too frequently. in such cases, it is recommended to use devices without the lvd reset option and to rely on the watchdog function to detect application runaway conditions. figure 14. low voltage detector reset function figure 15. low voltage detector reset signal note: see electrical characteristics for values of v lvdup and v lvddown figure 16. temporization timing diagram after an internal reset low voltage detector reset v dd from watchdog reset reset reset v dd v lvdup v lvddown v dd addresses $fffe temporization (4096 cpu clock cycles) v lvdup 19
20/101 st72e311 st72t311 4 interrupts the st7 core may be interrupted by one of two dif- ferent methods: maskable hardware interrupts as listed in the interrupt mapping table and a non- maskable software interrupt (trap). the interrupt processing flowchart is shown in figure 1 . the maskable interrupts must be enabled by clearing the i bit in order to be serviced. however, disabled interrupts may be latched and processed when they are enabled (see external interrupts subsection). note: after reset, all interrupts are disabled. when an interrupt has to be serviced: C normal processing is suspended at the end of the current instruction execution. C the pc, x, a and cc registers are saved onto the stack. C the i bit of the cc register is set to prevent addi- tional interrupts. C the pc is then loaded with the interrupt vector of the interrupt to service and the first instruction of the interrupt service routine is fetched (refer to the interrupt mapping table for vector address- es). the interrupt service routine should finish with the iret instruction which causes the contents of the saved registers to be recovered from the stack. note: as a consequence of the iret instruction, the i bit will be cleared and the main program will resume. priority management by default, a servicing interrupt cannot be inter- rupted because the i bit is set by hardware enter- ing in interrupt routine. in the case when several interrupts are simultane- ously pending, an hardware priority defines which one will be serviced first (see the interrupt map- ping table). interrupts and low power mode all interrupts allow the processor to leave the wait low power mode. only external and specifi- cally mentioned interrupts allow the processor to leave the halt low power mode (refer to the exit from halt column in the interrupt mapping ta- ble). 4.1 non maskable software interrupt this interrupt is entered when the trap instruc- tion is executed regardless of the state of the i bit. it will be serviced according to the flowchart on figure 1 . 4.2 external interrupts external interrupt vectors can be loaded into the pc register if the corresponding external interrupt occurred and if the i bit is cleared. these interrupts allow the processor to leave the halt low power mode. the external interrupt polarity is selected through the miscellaneous register or interrupt register (if available). an external interrupt triggered on edge will be latched and the interrupt request automatically cleared upon entering the interrupt service routine. if several input pins, connected to the same inter- rupt vector, are configured as interrupts, their sig- nals are logically anded and inverted before en- tering the edge/level detection block. caution: the type of sensitivity defined in the mis- cellaneous or interrupt register (if available) ap- plies to the ei source. in case of an anded source (as described on the i/o ports section), a low level on an i/o pin configured as input with interrupt, masks the interrupt request even in case of rising- edge sensitivity. 4.3 peripheral interrupts different peripheral interrupt flags in the status register are able to cause an interrupt when they are active if both: C the i bit of the cc register is cleared. C the corresponding enable bit is set in the control register. if any of these two conditions is false, the interrupt is latched and thus remains pending. clearing an interrupt request is done by: C writing 0 to the corresponding bit in the status register or C access to the status register while the flag is set followed by a read or write of an associated reg- ister. note : the clearing sequence resets the internal latch. a pending interrupt (i.e. waiting for being en- abled) will therefore be lost if the clear sequence is executed. 20
21/101 st72e311 st72t311 interrupts (contd) figure 17. interrupt processing flowchart i bit set? y n iret? y n from reset load pc from interrupt vector stack pc, x, a, cc set i bit fetch next instruction execute instruction this clears i bit by default restore pc, x, a, cc from stack interrupt y n pending? 21
22/101 st72e311 st72t311 table 6. interrupt mapping source block description register label flag exit from halt vector address priority order reset reset n/a n/a yes fffeh-ffffh trap software n/a n/a no fffch-fffdh not used fffah-fffbh not used fff8h-fff9h ei0 ext. interrupt (ports pa0:pa3) n/a n/a yes fff6h-fff7h ei1 ext. interrupt (ports pf0:pf2) n/a n/a fff4h-fff5h ei2 ext. interrupt (ports pb0:pb3) n/a n/a fff2h-fff3h ei3 ext. interrupt (ports pb4:pb7) n/a n/a fff0h-fff1h not used ffeeh-ffefh spi transfer complete spisr spif no ffech-ffedh mode fault modf timer a input capture 1 tasr icf1_a ffeah-ffebh output compare 1 ocf1_a input capture 2 icf2_a output compare 2 ocf2_a timer overflow tof_a timer b input capture 1 tbsr icf1_b ffe8h-ffe9h output compare 1 ocf1_b input capture 2 icf2_b output compare 2 ocf2_b timer overflow tof_b sci transmit buffer empty scisr tdre ffe6h-ffe7h transmit complete tc receive buffer full rdrf idle line detect idle overrun or not used ffe4h-ffe5h not used ffe2h-ffe3h not used ffe0h-ffe1h highest priority priority lowest 22
23/101 st72e311 st72t311 4.4 power saving modes 4.4.1 introduction there are three power saving modes. slow mode is selected by setting the relevant bits in the mis- cellaneous register. wait and halt modes may be entered using the wfi and halt instructions. 4.4.2 slow mode in slow mode, the oscillator frequency can be di- vided by a value defined in the miscellaneous register. the cpu and peripherals are clocked at this lower frequency. slow mode is used to reduce power consumption, and enables the user to adapt clock frequency to available supply voltage. 4.4.3 wait mode wait mode places the mcu in a low power con- sumption mode by stopping the cpu. all peripher- als remain active. during wait mode, the i bit (cc register) is cleared, so as to enable all interrupts. all other registers and memory remain unchanged. the mcu will remain in wait mode until an inter- rupt or reset occurs, whereupon the program counter branches to the starting address of the in- terrupt or reset service routine. the mcu will remain in wait mode until a reset or an interrupt occurs, causing it to wake up. refer to figure 18 below. figure 18. wait flow chart wfi instruction reset interrupt y n n y cpu clock oscillator periph. clock i-bit on on cleared off note: before servicing an interrupt, the cc register is pushed on the stack. the i-bit is set during the inter- rupt routine and cleared when the cc register is popped. 4096 cpu clock fetch reset vector or service interrupt cycles delay cpu clock oscillator periph. clock i-bit on on set on cpu clock oscillator periph. clock i-bit on on set on 23
24/101 st72e311 st72t311 power saving modes (contd) 4.4.4 halt mode the halt mode is the mcu lowest power con- sumption mode. the halt mode is entered by exe- cuting the halt instruction. the internal oscillator is then turned off, causing all internal processing to be stopped, including the operation of the on-chip peripherals. the halt mode cannot be used when the watchdog is enabled, if the halt instruction is executed while the watchdog system is enabled, a watchdog reset is generated thus resetting the en- tire mcu. when entering halt mode, the i bit in the cc reg- ister is cleared so as to enable external interrupts. if an interrupt occurs, the cpu becomes active. the mcu can exit the halt mode upon reception of an interrupt or a reset. refer to the interrupt map- ping table. the oscillator is then turned on and a stabilization time is provided before releasing cpu operation. the stabilization time is 4096 cpu clock cycles. after the start up delay, the cpu continues oper- ation by servicing the interrupt which wakes it up or by fetching the reset vector if a reset wakes it up. figure 19. halt flow chart n n external interrupt 1) reset halt instruction 4096 cpu clock fetch reset vector or service interrupt cycles delay cpu clock oscillator periph. clock 2) i-bit on off set on cpu clock oscillator periph. clock i-bit off off cleared off y y wdg enabled? n y reset watchdog 1) or some specific interrupts note: before servicing an interrupt, the cc register is pushed on the stack. the i-bit is set during the inter- rupt routine and cleared when the cc register is popped. cpu clock oscillator periph. clock i-bit on on set on 2) if reset periph. clock = on ; if interrupt periph. clock = off 24
25/101 st72e311 st72t311 4.5 miscellaneous register the miscellaneous register allows to select the slow operating mode, the polarity of external in- terrupt requests and to output the internal clock. register address: 0020h read/write reset value: 0000 0000 (00h) bit 7:6 = pei[3:2] external interrupt ei3 and ei2 polarity options . these bits are set and cleared by software. they determine which event on ei2 and ei3 causes the external interrupt according to table 7 . table 7. ei2 and ei3 external interrupt polarity options note: any modification of one of these two bits re- sets the interrupt request related to this interrupt vector. bit 5 = mco main clock out this bit is set and cleared by software. when set, it enables the output of the internal clock on the ppf0 i/o port. 0 - pf0 is a general purpose i/o port. 1 - mco alternate function (f cpu is output on pf0 pin). bit 4:3 = pei[1:0] external interrupt ei1 and ei0 polarity options . these bits are set and cleared by software. they determine which event on ei0 and ei1 causes the external interrupt according to table 8 . table 8. ei0 and ei1 external interrupt polarity options note: any modification of one of these two bits re- sets the interrupt request related to this interrupt vector. bit 2:1 = psm[1:0] prescaler for slow mode these bits are set and cleared by soft- ware. they determine the cpu clock when the sms bit is set according to the following table. table 9. f cpu value in slow mode bit 0 = sms slow mode select this bit is set and cleared by software. 0: normal mode - f cpu = f osc / 2 (reset state) 1: slow mode - the f cpu value is determined by the psm[1:0] bits. 70 pei3 pei2 mco pei1 pei0 psm1 psm0 sms mode pei3 pei2 falling edge and low level (reset state) 00 falling edge only 1 0 rising edge only 0 1 rising and falling edge 1 1 mode pei1 pei0 falling edge and low level (reset state) 00 falling edge only 1 0 rising edge only 0 1 rising and falling edge 1 1 f cpu value psm1 psm0 f osc / 4 0 0 f osc / 16 0 1 f osc / 8 1 0 f osc / 32 1 1 25
26/101 st72e311 st72t311 5 on-chip peripherals 5.1 i/o ports 5.1.1 introduction the i/o ports offer different functional modes: C transfer of data through digital inputs and outputs and for specific pins: C analog signal input (adc) C alternate signal input/output for the on-chip pe- ripherals. C external interrupt generation an i/o port is composed of up to 8 pins. each pin can be programmed independently as digital input (with or without interrupt generation) or digital out- put. 5.1.2 functional description each port is associated to 2 main registers: C data register (dr) C data direction register (ddr) and some of them to an optional register: C option register (or) each i/o pin may be programmed using the corre- sponding register bits in ddr and or registers: bit x corresponding to pin x of the port. the same cor- respondence is used for the dr register. the following description takes into account the or register, for specific ports which do not provide this register refer to the i/o port implementation section 4.1.3 . the generic i/o block diagram is shown on figure 21 . 5.1.2.1 input modes the input configuration is selected by clearing the corresponding ddr register bit. in this case, reading the dr register returns the digital value applied to the external i/o pin. different input modes can be selected by software through the or register. notes : 1. all the inputs are triggered by a schmitt trigger. 2. when switching from input mode to output mode, the dr register should be written first to output the correct value as soon as the port is con- figured as an output. interrupt function when an i/o is configured in input with interrupt, an event on this i/o can generate an external in- terrupt request to the cpu. the interrupt polarity is given independently according to the description mentioned in the miscellaneous register or in the interrupt register (where available). each pin can independently generate an interrupt request. each external interrupt vector is linked to a dedi- cated group of i/o port pins (see interrupts sec- tion). if several input pins are configured as inputs to the same interrupt vector, their signals are logi- cally anded before entering the edge/level detec- tion block. for this reason if one of the interrupt pins is tied low, it masks the other ones. 5.1.2.2 output mode the pin is configured in output mode by setting the corresponding ddr register bit. in this mode, writing 0 or 1 to the dr register applies this digital value to the i/o pin through the latch. then reading the dr register returns the previously stored value. note : in this mode, the interrupt function is disa- bled. 5.1.2.3 digital alternate function when an on-chip peripheral is configured to use a pin, the alternate function is automatically select- ed. this alternate function takes priority over standard i/o programming. when the signal is coming from an on-chip peripheral, the i/o pin is automatically configured in output mode (push-pull or open drain according to the peripheral). when the signal is going to an on-chip peripheral, the i/o pin has to be configured in input mode. in this case, the pins state is also digitally readable by addressing the dr register. notes: 1. input pull-up configuration can cause an unex- pected value at the input of the alternate peripher- al input. 2. when the on-chip peripheral uses a pin as input and output, this pin must be configured as an input (ddr = 0). warning : the alternate function must not be acti- vated as long as the pin is configured as input with interrupt, in order to avoid generating spurious in- terrupts. 26
27/101 st72e311 st72t311 i/o ports (contd) 5.1.2.4 analog alternate function when the pin is used as an adc input the i/o must be configured as input, floating. the analog multi- plexer (controlled by the adc registers) switches the analog voltage present on the selected pin to the common analog rail which is connected to the adc input. it is recommended not to change the voltage level or loading on any port pin while conversion is in progress. furthermore it is recommended not to have clocking pins located close to a selected an- alog pin. warning : the analog input voltage level must be within the limits stated in the absolute maximum ratings. 5.1.3 i/o port implementation the hardware implementation on each i/o port de- pends on the settings in the ddr and or registers and specific feature of the i/o port such as adc in- put (see figure 21 ) or true open drain. switching these i/o ports from one state to another should be done in a sequence that prevents unwanted side effects. recommended safe transitions are il- lustrated in figure 20 . other transitions are poten- tially risky and should be avoided, since they are likely to present unwanted side-effects such as spurious interrupt generation. figure 20. recommended i/o state transition diagram with interrupt input output no interrupt input push-pull open-drain output 27
28/101 st72e311 st72t311 i/o ports (contd) figure 21 . i/o block diagram table 10. port mode configuration legend : 0 - present, not activated 1 - present and activated notes : C no or register on some ports (see register map). C adc switch on ports with analog alternate functions. dr ddr latch latch data bus dr sel ddr sel v dd pa d analog switch analog enable (adc) m u x alternate alternate alternate enable common analog rail alternate m u x alternate input pull-up output p-buffer (s ee t able b elow ) n-buffer 1 0 1 0 or latch or sel from other bits external pull-up condition enable enable gnd (s ee t able below ) (s ee n ote below ) cmos schmitt trigger source (eix) interrupt polarity sel gnd v dd d iode (s ee t able below ) configuration mode pull-up p-buffer v dd diode floating 0 0 1 pull-up 1 0 1 push-pull 0 1 1 true open drain not present not present not present open drain (logic level) 0 0 1 28
29/101 st72e311 st72t311 i/o ports (contd) table 11. port configuration notes: 1. st72t311n only 2. for otp/eprom version, when or=0: floating & when or=1: reserved 3. for otp/eprom version, when or=0: open-drain, high sink capability & when or=1: reserved * reset state (the bits corresponding to unavailable pins are forced to 1 by hardware, this affects the reset status value). warning: all bits of the ddr register which correspond to unconnected i/os must be left at their reset val- ue. they must not be modified by the user otherwise a spurious interrupt may be generated. port pin name input (ddr = 0) output (ddr = 1) or = 0 or = 1 or = 0 or =1 port a pa0:pa2 1) floating* pull-up with interrupt open-drain push-pull pa3 floating* pull-up with interrupt open-drain push-pull pa4:pa7 floating* true open drain, high sink capability port b pb0:pb4 floating* pull-up with interrupt open-drain push-pull pb5:pb7 1) floating* pull-up with interrupt open-drain push-pull port c pc0:pc7 floating* pull-up open-drain push-pull port d pd0:pd5 floating* pull-up open-drain push-pull pd6:pd7 1) floating* pull-up open-drain push-pull port e pe0:pe1 floating* pull-up open-drain push-pull pe4:pe7 1) floating* 2) true open drain, high sink capability 3) port f pf0:pf2 floating* pull-up with interrupt open-drain push-pull pf4, pf6, pf7 floating* pull-up open-drain push-pull 29
30/101 st72e311 st72t311 i/o ports (contd) 5.1.4 register description 5.1.4.1 data registers port a data register (padr) port b data register (pbdr) port c data register (pcdr) port d data register (pddr) port e data register (pedr) port f data register (pfdr) read/write reset value: 0000 0000 (00h) bit 7:0 = d7-d0 data register 8 bits. the dr register has a specific behaviour accord- ing to the selected input/output configuration. writ- ing the dr register is always taken in account even if the pin is configured as an input. reading the dr register returns either the dr register latch content (pin configured as output) or the digital val- ue applied to the i/o pin (pin configured as input). 5.1.4.2 data direction registers port a data direction register (paddr) port b data direction register (pbddr) port c data direction register (pcddr) port d data direction register (pdddr) port e data direction register (peddr) port f data direction register (pfddr) read/write reset value: 0000 0000 (00h) (input mode) bit 7:0 = dd7-dd0 data direction register 8 bits. the ddr register gives the input/output direction configuration of the pins. each bits is set and cleared by software. 0: input mode 1: output mode 5.1.4.3 option registers port a option register (paor) port b option register (pbor) port c option register (pbor) port d option register (pbor) port e option register (pbor) port f option register (pfor) read/write reset value: see register memory map table 4 bit 7:0 = o7-o0 option register 8 bits. the or register allow to distinguish in input mode if the interrupt capability or the floating configura- tion is selected. in output mode it select push-pull or open-drain capability. each bit is set and cleared by software. input mode: 0: floating input 1: input pull-up with interrupt output mode: 0: open-drain configuration 1: push-pull configuration 70 d7 d6 d5 d4 d3 d2 d1 d0 70 dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 70 o7 o6 o5 o4 o3 o2 o1 o0 30
31/101 st72e311 st72t311 i/o ports (contd) table 12. i/o port register map address (hex.) register label 76543210 0000h padr d7 d6 d5 d4 d3 d2 d1 d0 0001h paddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 0002h paor o7 o6 o5 o4 o3 o2 o1 o0 0004h pcdr d7 d6 d5 d4 d3 d2 d1 d0 0005h pcddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 0006h pcor o7 o6 o5 o4 o3 o2 o1 o0 0008h pbdr d7 d6 d5 d4 d3 d2 d1 d0 0009h pbddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 000ah pbor o7 o6 o5 o4 o3 o2 o1 o0 000ch pedr d7 d6 d5 d4 d3 d2 d1 d0 000dh peddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 000eh peor o7 o6 o5 o4 o3 o2 o1 o0 0010h pddr d7 d6 d5 d4 d3 d2 d1 d0 0011h pdddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 0012h pdor o7 o6 o5 o4 o3 o2 o1 o0 0014h pfdr d7 d6 d5 d4 d3 d2 d1 d0 0015h pfddr dd7 dd6 dd5 dd4 dd3 dd2 dd1 dd0 0016h pfor o7 o6 o5 o4 o3 o2 o1 o0 31
32/101 st72e311 st72t311 5.2 watchdog timer (wdg) 5.2.1 introduction the watchdog timer is used to detect the occur- rence of a software fault, usually generated by ex- ternal interference or by unforeseen logical condi- tions, which causes the application program to abandon its normal sequence. the watchdog cir- cuit generates an mcu reset on expiry of a pro- grammed time period, unless the program refresh- es the counters contents before the t6 bit be- comes cleared. 5.2.2 main features n programmable timer (64 increments of 12288 cpu cycles) n programmable reset n reset (if watchdog activated) after a halt instruction or when the t6 bit reaches zero n hardware watchdog selectable by option byte n watchdog reset indicated by status flag (in versions with safe reset option only) 5.2.3 functional description the counter value stored in the cr register (bits t[6:0]), is decremented every 12,288 machine cy- cles, and the length of the timeout period can be programmed by the user in 64 increments. if the watchdog is activated (the wdga bit is set) and when the 7-bit timer (bits t[6:0]) rolls over from 40h to 3fh (t6 becomes cleared), it initiates a reset cycle pulling low the reset pin for typically 500ns. figure 22. watchdog block diagram reset wdga 7-bit downcounter f cpu t6 t0 clock divider watchdog control register (cr) ? 12288 t1 t2 t3 t4 t5 32
33/101 st72e311 st72t311 watchdog timer (contd) the application program must write in the cr reg- ister at regular intervals during normal operation to prevent an mcu reset. the value to be stored in the cr register must be between ffh and c0h (see table 1 ): C the wdga bit is set (watchdog enabled) C the t6 bit is set to prevent generating an imme- diate reset C the t[5:0] bits contain the number of increments which represents the time delay before the watchdog produces a reset. table 13.watchdog timing (f cpu = 8 mhz) notes: following a reset, the watchdog is disa- bled. once activated it cannot be disabled, except by a reset. the t6 bit can be used to generate a software re- set (the wdga bit is set and the t6 bit is cleared). if the watchdog is activated, the halt instruction will generate a reset. 5.2.4 hardware watchdog option if hardware watchdog is selected by option byte, the watchdog is always active and the wdga bit in the cr is not used. refer to the device-specific option byte descrip- tion. 5.2.5 low power modes 5.2.6 interrupts none. 5.2.7 register description control register (cr) read/write reset value: 0111 1111 (7fh) bit 7 = wdga activation bit . this bit is set by software and only cleared by hardware after a reset. when wdga = 1, the watchdog can generate a reset. 0: watchdog disabled 1: watchdog enabled note: this bit is not used if the hardware watch- dog option is enabled by option byte. bit 6:0 = t[6:0] 7-bit timer (msb to lsb). these bits contain the decremented value. a reset is produced when it rolls over from 40h to 3fh (t6 becomes cleared). status register (sr) read/write reset value*: 0000 0000 (00h) bit 0 = wdogf watchdog flag . this bit is set by a watchdog reset and cleared by software or a power on/off reset. this bit is useful for distinguishing power/on off or external reset and watchdog reset. 0: no watchdog reset occurred 1: watchdog reset occurred * only by software and power on/off reset note: this register is not used in versions without lvd reset. cr register initial value wdg timeout period (ms) max ffh 98.304 min c0h 1.536 mode description wait no effect on watchdog. halt immediate reset generation as soon as the halt instruction is executed if the watchdog is activated (wdga bit is set). 70 wdga t6 t5 t4 t3 t2 t1 t0 70 - ------wdogf 33
34/101 st72e311 st72t311 table 14. wdg register map address (hex.) register label 76543210 2a wdgcr reset value wdga 0 t6 1 t5 1 t4 1 t3 1 t2 1 t1 1 t0 1 2b wdgsr reset value - 0 - 0 - 0 - 0 - 0 - 0 - 0 wdogf 0 34
35/101 st72e311 st72t311 5.3 16-bit timer 5.3.1 introduction the timer consists of a 16-bit free-running counter driven by a programmable prescaler. it may be used for a variety of purposes, including measuring the pulse lengths of up to two input sig- nals ( input capture ) or generating up to two output waveforms ( output compare and pwm ). pulse lengths and waveform periods can be mod- ulated from a few microseconds to several milli- seconds using the timer prescaler and the cpu clock prescaler. some st7 devices have two on-chip 16-bit timers. they are completely independent, and do not share any resources. they are synchronized after a mcu reset as long as the timer clock frequen- cies are not modified. this description covers one or two 16-bit timers. in st7 devices with two timers, register names are prefixed with ta (timer a) or tb (timer b). 5.3.2 main features n programmable prescaler: f cpu divided by 2, 4 or 8. n overflow status flag and maskable interrupt n external clock input (must be at least 4 times slower than the cpu clock speed) with the choice of active edge n output compare functions with: C 2 dedicated 16-bit registers C 2 dedicated programmable signals C 2 dedicated status flags C 1 dedicated maskable interrupt n input capture functions with: C 2 dedicated 16-bit registers C 2 dedicated active edge selection signals C 2 dedicated status flags C 1 dedicated maskable interrupt n pulse width modulation mode (pwm) n one pulse mode n 5 alternate functions on i/o ports (icap1, icap2, ocmp1, ocmp2, extclk)* the block diagram is shown in figure 1 . *note: some timer pins may not be available (not bonded) in some st7 devices. refer to the device pin out description. when reading an input signal on a non-bonded pin, the value will always be 1. 5.3.3 functional description 5.3.3.1 counter the main block of the programmable timer is a 16-bit free running upcounter and its associated 16-bit registers. the 16-bit registers are made up of two 8-bit registers called high & low. counter register (cr): C counter high register (chr) is the most sig- nificant byte (ms byte). C counter low register (clr) is the least sig- nificant byte (ls byte). alternate counter register (acr) C alternate counter high register (achr) is the most significant byte (ms byte). C alternate counter low register (aclr) is the least significant byte (ls byte). these two read-only 16-bit registers contain the same value but with the difference that reading the aclr register does not clear the tof bit (timer overflow flag), located in the status register (sr). (see note at the end of paragraph titled 16-bit read sequence). writing in the clr register or aclr register resets the free running counter to the fffch value. both counters have a reset value of fffch (this is the only value which is reloaded in the 16-bit tim- er). the reset value of both counters is also fffch in one pulse mode and pwm mode. the timer clock depends on the clock control bits of the cr2 register, as illustrated in table 1 . the value in the counter register repeats every 131072, 262144 or 524288 cpu clock cycles de- pending on the cc[1:0] bits. the timer frequency can be f cpu /2, f cpu /4, f cpu /8 or an external frequency. 35
36/101 st72e311 st72t311 16-bit timer (contd) figure 23. timer block diagram mcu-peripheral interface counter alternate output compare register output compare edge detect overflow detect circuit 1/2 1/4 1/8 8-bit buffer st7 internal bus latch1 ocmp1 icap1 extclk f cpu timer interrupt icf2 icf1 0 0 0 ocf2 ocf1 tof pwm oc1e exedg iedg2 cc0 cc1 oc2e opm folv2 icie olvl1 iedg1 olvl2 folv1 ocie toie icap2 latch2 ocmp2 8 8 8 low 16 8 high 16 16 16 16 (control register 1) cr1 (control register 2) cr2 (status register) sr 6 16 8 8 8 8 8 8 high low high high high low low low exedg timer internal bus circuit1 edge detect circuit2 circuit 1 output compare register 2 input capture register 1 input capture register 2 cc[1:0] counter pin pin pin pin pin register register note: if ic, oc and to interrupt requests have separate vectors then the last or is not present (see device interrupt vector table) (see note) 36
37/101 st72e311 st72t311 16-bit timer (contd) 16-bit read sequence: (from either the counter register or the alternate counter register). the user must read the ms byte first, then the ls byte value is buffered automatically. this buffered value remains unchanged until the 16-bit read sequence is completed, even if the user reads the ms byte several times. after a complete reading sequence, if only the clr register or aclr register are read, they re- turn the ls byte of the count value at the time of the read. whatever the timer mode used (input capture, out- put compare, one pulse mode or pwm mode) an overflow occurs when the counter rolls over from ffffh to 0000h then: C the tof bit of the sr register is set. C a timer interrupt is generated if: C toie bit of the cr1 register is set and C i bit of the cc register is cleared. if one of these conditions is false, the interrupt re- mains pending to be issued as soon as they are both true. clearing the overflow interrupt request is done in two steps: 1. reading the sr register while the tof bit is set. 2. an access (read or write) to the clr register. note: the tof bit is not cleared by accessing the aclr register. the advantage of accessing the aclr register rather than the clr register is that it allows simultaneous use of the overflow function and reading the free running counter at random times (for example, to measure elapsed time) with- out the risk of clearing the tof bit erroneously. the timer is not affected by wait mode. in halt mode, the counter stops counting until the mode is exited. counting then resumes from the previous count (mcu awakened by an interrupt) or from the reset count (mcu awakened by a reset). 5.3.3.2 external clock the external clock (where available) is selected if cc0=1 and cc1=1 in the cr2 register. the status of the exedg bit in the cr2 register determines the type of level transition on the exter- nal clock pin extclk that will trigger the free run- ning counter. the counter is synchronised with the falling edge of the internal cpu clock. a minimum of four falling edges of the cpu clock must occur between two consecutive active edges of the external clock; thus the external clock fre- quency must be less than a quarter of the cpu clock frequency. is buffered read at t0 read returns the buffered ls byte value at t0 at t0 + d t other instructions beginning of the sequence sequence completed ls byte ls byte ms byte 37
38/101 st72e311 st72t311 16-bit timer (contd) figure 24. counter timing diagram, internal clock divided by 2 figure 25. counter timing diagram, internal clock divided by 4 figure 26. counter timing diagram, internal clock divided by 8 note: the mcu is in reset state when the internal reset signal is high. when it is low, the mcu is running. cpu clock fffd fffe ffff 0000 0001 0002 0003 internal reset timer clock counter register timer overflow flag (tof) fffc fffd 0000 0001 cpu clock internal reset timer clock counter register timer overflow flag (tof) cpu clock internal reset timer clock counter register timer overflow flag (tof) fffc fffd 0000 38
39/101 st72e311 st72t311 16-bit timer (contd) 5.3.3.3 input capture in this section, the index, i , may be 1 or 2 because there are 2 input capture functions in the 16-bit timer. the two input capture 16-bit registers (ic1r and ic2r) are used to latch the value of the free run- ning counter after a transition is detected by the icap i pin (see figure 5). the ic i r register is a read-only register. the active transition is software programmable through the iedg i bit of control registers (cr i ). timing resolution is one count of the free running counter: ( f cpu / cc[1:0]). procedure: to use the input capture function, select the fol- lowing in the cr2 register: C select the timer clock (cc[1:0]) (see table 1 ). C select the edge of the active transition on the icap2 pin with the iedg2 bit (the icap2 pin must be configured as a floating input). and select the following in the cr1 register: C set the icie bit to generate an interrupt after an input capture coming from either the icap1 pin or the icap2 pin C select the edge of the active transition on the icap1 pin with the iedg1 bit (the icap1pin must be configured as a floating input). when an input capture occurs: C the icf i bit is set. C the ic i r register contains the value of the free running counter on the active transition on the icap i pin (see figure 6 ). C a timer interrupt is generated if the icie bit is set and the i bit is cleared in the cc register. other- wise, the interrupt remains pending until both conditions become true. clearing the input capture interrupt request (i.e. clearing the icf i bit) is done in two steps: 1. reading the sr register while the icf i bit is set. 2. an access (read or write) to the ic i lr register. notes: 1. after reading the ic i hr register, the transfer of input capture data is inhibited and icf i will never be set until the ic i lr register is also read. 2. the ic i r register contains the free running counter value which corresponds to the most recent input capture. 3. the 2 input capture functions can be used together even if the timer also uses the 2 output compare functions. 4. in one pulse mode and pwm mode only the input capture 2 function can be used. 5. the alternate inputs (icap1 & icap2) are always directly connected to the timer. so any transitions on these pins activate the input cap- ture function. moreover if one of the icap i pin is configured as an input and the second one as an output, an interrupt can be generated if the user tog- gles the output pin and if the icie bit is set. this can be avoided if the input capture func- tion i is disabled by reading the ic i hr (see note 1). 6. the tof bit can be used with an interrupt in order to measure events that exceed the timer range (ffffh). ms byte ls byte icir ic i hr ic i lr 39
40/101 st72e311 st72t311 16-bit timer (contd) figure 27. input capture block diagram figure 28. input capture timing diagram icie cc0 cc1 16-bit free running counter iedg1 (control register 1) cr1 (control register 2) cr2 icf2 icf1 0 0 0 (status register) sr iedg2 icap1 icap2 edge detect circuit2 16-bit ic1r register ic2r register edge detect circuit1 pin pin ff01 ff02 ff03 ff03 timer clock counter register icapi pin icapi flag icapi register note: a ctive edge is rising edge. 40
41/101 st72e311 st72t311 16-bit timer (contd) 5.3.3.4 output compare in this section, the index, i , may be 1 or 2 because there are 2 output compare functions in the 16-bit timer. this function can be used to control an output waveform or indicate when a period of time has elapsed. when a match is found between the output com- pare register and the free running counter, the out- put compare function: C assigns pins with a programmable value if the ocie bit is set C sets a flag in the status register C generates an interrupt if enabled two 16-bit registers output compare register 1 (oc1r) and output compare register 2 (oc2r) contain the value to be compared to the counter register each timer clock cycle. these registers are readable and writable and are not affected by the timer hardware. a reset event changes the oc i r value to 8000h. timing resolution is one count of the free running counter: ( f cpu/ cc[1:0] ). procedure: to use the output compare function, select the fol- lowing in the cr2 register: C set the oc i e bit if an output is needed then the ocmp i pin is dedicated to the output compare i signal. C select the timer clock (cc[1:0]) (see table 1 ). and select the following in the cr1 register: C select the olvl i bit to applied to the ocmp i pins after the match occurs. C set the ocie bit to generate an interrupt if it is needed. when a match is found between ocri register and cr register: C ocf i bit is set. C the ocmp i pin takes olvl i bit value (ocmp i pin latch is forced low during reset). C a timer interrupt is generated if the ocie bit is set in the cr2 register and the i bit is cleared in the cc register (cc). the oc i r register value required for a specific tim- ing application can be calculated using the follow- ing formula: where: d t = output compare period (in seconds) f cpu = cpu clock frequency (in hertz) presc = timer prescaler factor (2, 4 or 8 de- pending on cc[1:0] bits, see table 1 ) if the timer clock is an external clock, the formula is: where: d t = output compare period (in seconds) f ext = external timer clock frequency (in hertz) clearing the output compare interrupt request (i.e. clearing the ocf i bit) is done by: 1. reading the sr register while the ocf i bit is set. 2. an access (read or write) to the oc i lr register. the following procedure is recommended to pre- vent the ocf i bit from being set between the time it is read and the write to the oc i r register: C write to the oc i hr register (further compares are inhibited). C read the sr register (first step of the clearance of the ocf i bit, which may be already set). C write to the oc i lr register (enables the output compare function and clears the ocf i bit). ms byte ls byte oc i roc i hr oc i lr d oc i r = d t * f cpu presc d oc i r = d t * f ext 41
42/101 st72e311 st72t311 16-bit timer (contd) notes: 1. after a processor write cycle to the oc i hr reg- ister, the output compare function is inhibited until the oc i lr register is also written. 2. if the oc i e bit is not set, the ocmp i pin is a general i/o port and the olvl i bit will not appear when a match is found but an interrupt could be generated if the ocie bit is set. 3. when the timer clock is f cpu /2, ocf i and ocmp i are set while the counter value equals the oc i r register value (see figure 8 ). this behaviour is the same in opm or pwm mode. when the timer clock is f cpu /4, f cpu /8 or in external clock mode, ocf i and ocmp i are set while the counter value equals the oc i r regis- ter value plus 1 (see figure 9 ). 4. the output compare functions can be used both for generating external events on the ocmp i pins even if the input capture mode is also used. 5. the value in the 16-bit oc i r register and the olv i bit should be changed after each suc- cessful comparison in order to control an output waveform or establish a new elapsed timeout. forced compare output capability when the folv i bit is set by software, the olvl i bit is copied to the ocmp i pin. the olv i bit has to be toggled in order to toggle the ocmp i pin when it is enabled (oc i e bit=1). the ocf i bit is then not set by hardware, and thus no interrupt request is generated. folvl i bits have no effect in either one-pulse mode or pwm mode. figure 29. output compare block diagram output compare 16-bit circuit oc1r register 16 bit free running counter oc1e cc0 cc1 oc2e olvl1 olvl2 ocie (control register 1) cr1 (control register 2) cr2 0 0 0 ocf2 ocf1 (status register) sr 16-bit 16-bit ocmp1 ocmp2 latch 1 latch 2 oc2r register pin pin folv2 folv1 42
43/101 st72e311 st72t311 16-bit timer (contd) figure 30. output compare timing diagram, f timer =f cpu /2 figure 31. output compare timing diagram, f timer =f cpu /4 internal cpu clock timer clock counter register output compare register i (ocr i ) output compare flag i (ocf i ) ocmp i pin (olvl i =1) 2ed3 2ed0 2ed1 2ed2 2ed3 2ed4 2ecf internal cpu clock timer clock counter register output compare register i (ocr i ) compare register i latch 2ed3 2ed0 2ed1 2ed2 2ed3 2ed4 2ecf ocmp i pin (olvl i =1) output compare flag i (ocf i ) 43
44/101 st72e311 st72t311 16-bit timer (contd) 5.3.3.5 one pulse mode one pulse mode enables the generation of a pulse when an external event occurs. this mode is selected via the opm bit in the cr2 register. the one pulse mode uses the input capture1 function and the output compare1 function. procedure: to use one pulse mode: 1. load the oc1r register with the value corre- sponding to the length of the pulse (see the for- mula in the opposite column). 2. select the following in the cr1 register: C using the olvl1 bit, select the level to be ap- plied to the ocmp1 pin after the pulse. C using the olvl2 bit, select the level to be ap- plied to the ocmp1 pin during the pulse. C select the edge of the active transition on the icap1 pin with the iedg1 bit (the icap1 pin must be configured as floating input). 3. select the following in the cr2 register: C set the oc1e bit, the ocmp1 pin is then ded- icated to the output compare 1 function. C set the opm bit. C select the timer clock cc[1:0] (see table 1 ). then, on a valid event on the icap1 pin, the coun- ter is initialized to fffch and the olvl2 bit is loaded on the ocmp1 pin, the icf1 bit is set and the value fffdh is loaded in the ic1r register. because the icf1 bit is set when an active edge occurs, an interrupt can be generated if the icie bit is set. clearing the input capture interrupt request (i.e. clearing the icf i bit) is done in two steps: 1. reading the sr register while the icf i bit is set. 2. an access (read or write) to the ic i lr register. the oc1r register value required for a specific timing application can be calculated using the fol- lowing formula: where: t = pulse period (in seconds) f cpu = cpu clock frequency (in hertz) presc = timer prescaler factor (2, 4 or 8 depend- ing on the cc[1:0] bits, see table 1 ) if the timer clock is an external clock the formula is: where: t = pulse period (in seconds) f ext = external timer clock frequency (in hertz) when the value of the counter is equal to the value of the contents of the oc1r register, the olvl1 bit is output on the ocmp1 pin (see figure 10 ). notes: 1. the ocf1 bit cannot be set by hardware in one pulse mode but the ocf2 bit can generate an output compare interrupt. 2. when the pulse width modulation (pwm) and one pulse mode (opm) bits are both set, the pwm mode is the only active one. 3. if olvl1=olvl2 a continuous signal will be seen on the ocmp1 pin. 4. the icap1 pin can not be used to perform input capture. the icap2 pin can be used to perform input capture (icf2 can be set and ic2r can be loaded) but the user must take care that the counter is reset each time a valid edge occurs on the icap1 pin and icf1 can also generates interrupt if icie is set. 5. when one pulse mode is used oc1r is dedi- cated to this mode. nevertheless oc2r and ocf2 can be used to indicate that a period of time has elapsed but cannot generate an output waveform because the olvl2 level is dedi- cated to one pulse mode. event occurs counter = oc1r ocmp1 = olvl1 when when on icap1 one pulse mode cycle ocmp1 = olvl2 counter is reset to fffch icf1 bit is set oc i r value = t * f cpu presc - 5 oc i r = t * f ext -5 44
45/101 st72e311 st72t311 16-bit timer (contd) figure 32. one pulse mode timing example figure 33. pulse width modulation mode timing example counter fffc fffd fffe 2ed0 2ed1 2ed2 2ed3 fffc fffd olvl2 olvl2 olvl1 icap1 ocmp1 compare1 note: iedg1=1, oc1r=2ed0h, olvl1=0, olvl2=1 counter 34e2 34e2 fffc olvl2 olvl2 olvl1 ocmp1 compare2 compare1 compare2 note: oc1r=2ed0h, oc2r=34e2, olvl1=0, olvl2= 1 fffc fffd fffe 2ed0 2ed1 2ed2 45
46/101 st72e311 st72t311 16-bit timer (contd) 5.3.3.6 pulse width modulation mode pulse width modulation (pwm) mode enables the generation of a signal with a frequency and pulse length determined by the value of the oc1r and oc2r registers. the pulse width modulation mode uses the com- plete output compare 1 function plus the oc2r register, and so these functions cannot be used when the pwm mode is activated. procedure to use pulse width modulation mode: 1. load the oc2r register with the value corre- sponding to the period of the signal using the formula in the opposite column. 2. load the oc1r register with the value corre- sponding to the period of the pulse if olvl1=0 and olvl2=1, using the formula in the oppo- site column. 3. select the following in the cr1 register: C using the olvl1 bit, select the level to be ap- plied to the ocmp1 pin after a successful comparison with oc1r register. C using the olvl2 bit, select the level to be ap- plied to the ocmp1 pin after a successful comparison with oc2r register. 4. select the following in the cr2 register: C set oc1e bit: the ocmp1 pin is then dedicat- ed to the output compare 1 function. C set the pwm bit. C select the timer clock (cc[1:0]) (see table 1 ). if olvl1=1 and olvl2=0, the length of the posi- tive pulse is the difference between the oc2r and oc1r registers. if olvl1=olvl2 a continuous signal will be seen on the ocmp1 pin. the oc i r register value required for a specific tim- ing application can be calculated using the follow- ing formula: where: t = signal or pulse period (in seconds) f cpu = cpu clock frequency (in hertz) presc = timer prescaler factor (2, 4 or 8 depend- ing on cc[1:0] bits, see table 1 ) if the timer clock is an external clock the formula is: where: t = signal or pulse period (in seconds) f ext = external timer clock frequency (in hertz) the output compare 2 event causes the counter to be initialized to fffch (see figure 11 ) notes: 1. after a write instruction to the oc i hr register, the output compare function is inhibited until the oc i lr register is also written. 2. the ocf1 and ocf2 bits cannot be set by hardware in pwm mode, therefore the output compare interrupt is inhibited. 3. the icf1 bit is set by hardware when the coun- ter reaches the oc2r value and can produce a timer interrupt if the icie bit is set and the i bit is cleared. 4. in pwm mode the icap1 pin can not be used to perform input capture because it is discon- nected from the timer. the icap2 pin can be used to perform input capture (icf2 can be set and ic2r can be loaded) but the user must take care that the counter is reset after each period and icf1 can also generate an interrupt if icie is set. 5. when the pulse width modulation (pwm) and one pulse mode (opm) bits are both set, the pwm mode is the only active one. counter ocmp1 = olvl2 counter = oc2r ocmp1 = olvl1 when when = oc1r pulse width modulation cycle counter is reset to fffch icf1 bit is set oc i r value = t * f cpu presc - 5 oc i r = t * f ext -5 46
47/101 st72e311 st72t311 16-bit timer (contd) 5.3.4 low power modes 5.3.5 interrupts note: the 16-bit timer interrupt events are connected to the same interrupt vector (see interrupts chap- ter). these events generate an interrupt if the corresponding enable control bit is set and the interrupt mask in the cc register is reset (rim instruction). 5.3.6 summary of timer modes 1) see note 4 in section 0.1.3.5 one pulse mode 2) see note 5 in section 0.1.3.5 one pulse mode 3) see note 4 in section 0.1.3.6 pulse width modulation mode mode description wait no effect on 16-bit timer. timer interrupts cause the device to exit from wait mode. halt 16-bit timer registers are frozen. in halt mode, the counter stops counting until halt mode is exited. counting resumes from the previous count when the mcu is woken up by an interrupt with exit from halt mode capability or from the counter reset value when the mcu is woken up by a reset. if an input capture event occurs on the icap i pin, the input capture detection circuitry is armed. consequent- ly, when the mcu is woken up by an interrupt with exit from halt mode capability, the icf i bit is set, and the counter value present when exiting from halt mode is captured into the ic i r register. interrupt event event flag enable control bit exit from wait exit from halt input capture 1 event/counter reset in pwm mode icf1 icie yes no input capture 2 event icf2 yes no output compare 1 event (not available in pwm mode) ocf1 ocie yes no output compare 2 event (not available in pwm mode) ocf2 yes no timer overflow event tof toie yes no modes available resources input capture 1 input capture 2 output compare 1 output compare 2 input capture (1 and/or 2) yes yes yes yes output compare (1 and/or 2) yes yes yes yes one pulse mode no not recommended 1) no partially 2) pwm mode no not recommended 3) no no 47
48/101 st72e311 st72t311 16-bit timer (contd) 5.3.7 register description each timer is associated with three control and status registers, and with six pairs of data registers (16-bit values) relating to the two input captures, the two output compares, the counter and the al- ternate counter. control register 1 (cr1) read/write reset value: 0000 0000 (00h) bit 7 = icie input capture interrupt enable. 0: interrupt is inhibited. 1: a timer interrupt is generated whenever the icf1 or icf2 bit of the sr register is set. bit 6 = ocie output compare interrupt enable. 0: interrupt is inhibited. 1: a timer interrupt is generated whenever the ocf1 or ocf2 bit of the sr register is set. bit 5 = toie timer overflow interrupt enable. 0: interrupt is inhibited. 1: a timer interrupt is enabled whenever the tof bit of the sr register is set. bit 4 = folv2 forced output compare 2. this bit is set and cleared by software. 0: no effect on the ocmp2 pin. 1: forces the olvl2 bit to be copied to the ocmp2 pin, if the oc2e bit is set and even if there is no successful comparison. bit 3 = folv1 forced output compare 1. this bit is set and cleared by software. 0: no effect on the ocmp1 pin. 1: forces olvl1 to be copied to the ocmp1 pin, if the oc1e bit is set and even if there is no suc- cessful comparison. bit 2 = olvl2 output level 2. this bit is copied to the ocmp2 pin whenever a successful comparison occurs with the oc2r reg- ister and ocxe is set in the cr2 register. this val- ue is copied to the ocmp1 pin in one pulse mode and pulse width modulation mode. bit 1 = iedg1 input edge 1. this bit determines which type of level transition on the icap1 pin will trigger the capture. 0: a falling edge triggers the capture. 1: a rising edge triggers the capture. bit 0 = olvl1 output level 1. the olvl1 bit is copied to the ocmp1 pin when- ever a successful comparison occurs with the oc1r register and the oc1e bit is set in the cr2 register. 70 icie ocie toie folv2 folv1 olvl2 iedg1 olvl1 48
49/101 st72e311 st72t311 16-bit timer (contd) control register 2 (cr2) read/write reset value: 0000 0000 (00h) bit 7 = oc1e output compare 1 pin enable. this bit is used only to output the signal from the timer on the ocmp1 pin (olv1 in output com- pare mode, both olv1 and olv2 in pwm and one-pulse mode). whatever the value of the oc1e bit, the internal output compare 1 function of the timer remains active. 0: ocmp1 pin alternate function disabled (i/o pin free for general-purpose i/o). 1: ocmp1 pin alternate function enabled. bit 6 = oc2e output compare 2 pin enable. this bit is used only to output the signal from the timer on the ocmp2 pin (olv2 in output com- pare mode). whatever the value of the oc2e bit, the internal output compare 2 function of the timer remains active. 0: ocmp2 pin alternate function disabled (i/o pin free for general-purpose i/o). 1: ocmp2 pin alternate function enabled. bit 5 = opm one pulse mode. 0: one pulse mode is not active. 1: one pulse mode is active, the icap1 pin can be used to trigger one pulse on the ocmp1 pin; the active transition is given by the iedg1 bit. the length of the generated pulse depends on the contents of the oc1r register. bit 4 = pwm pulse width modulation. 0: pwm mode is not active. 1: pwm mode is active, the ocmp1 pin outputs a programmable cyclic signal; the length of the pulse depends on the value of oc1r register; the period depends on the value of oc2r regis- ter. bits 3:2 = cc[1:0] clock control. the timer clock mode depends on these bits: table 15. clock control bits note : if the external clock pin is not available, pro- gramming the external clock configuration stops the counter. bit 1 = iedg2 input edge 2. this bit determines which type of level transition on the icap2 pin will trigger the capture. 0: a falling edge triggers the capture. 1: a rising edge triggers the capture. bit 0 = exedg external clock edge. this bit determines which type of level transition on the external clock pin (extclk) will trigger the counter register. 0: a falling edge triggers the counter register. 1: a rising edge triggers the counter register. 70 oc1e oc2e opm pwm cc1 cc0 iedg2 exedg timer clock cc1 cc0 f cpu / 4 0 0 f cpu / 2 0 1 f cpu / 8 1 0 external clock (where available) 11 49
50/101 st72e311 st72t311 16-bit timer (contd) status register (sr) read only reset value: 0000 0000 (00h) the three least significant bits are not used. bit 7 = icf1 input capture flag 1. 0: no input capture (reset value). 1: an input capture has occurred on the icap1 pin or the counter has reached the oc2r value in pwm mode. to clear this bit, first read the sr register, then read or write the low byte of the ic1r (ic1lr) register. bit 6 = ocf1 output compare flag 1. 0: no match (reset value). 1: the content of the free running counter matches the content of the oc1r register. to clear this bit, first read the sr register, then read or write the low byte of the oc1r (oc1lr) register. bit 5 = tof timer overflow flag. 0: no timer overflow (reset value). 1: the free running counter has rolled over from ffffh to 0000h. to clear this bit, first read the sr register, then read or write the low byte of the cr (clr) register. note: reading or writing the aclr register does not clear tof. bit 4 = icf2 input capture flag 2. 0: no input capture (reset value). 1: an input capture has occurred on the icap2 pin. to clear this bit, first read the sr register, then read or write the low byte of the ic2r (ic2lr) register. bit 3 = ocf2 output compare flag 2. 0: no match (reset value). 1: the content of the free running counter matches the content of the oc2r register. to clear this bit, first read the sr register, then read or write the low byte of the oc2r (oc2lr) register. bit 2-0 = reserved, forced by hardware to 0. input capture 1 high register (ic1hr) read only reset value: undefined this is an 8-bit read only register that contains the high part of the counter value (transferred by the input capture 1 event). input capture 1 low register (ic1lr) read only reset value: undefined this is an 8-bit read only register that contains the low part of the counter value (transferred by the in- put capture 1 event). output compare 1 high register (oc1hr) read/write reset value: 1000 0000 (80h) this is an 8-bit register that contains the high part of the value to be compared to the chr register. output compare 1 low register (oc1lr) read/write reset value: 0000 0000 (00h) this is an 8-bit register that contains the low part of the value to be compared to the clr register. 70 icf1 ocf1 tof icf2 ocf2 0 0 0 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 50
51/101 st72e311 st72t311 16-bit timer (contd) output compare 2 high register (oc2hr) read/write reset value: 1000 0000 (80h) this is an 8-bit register that contains the high part of the value to be compared to the chr register. output compare 2 low register (oc2lr) read/write reset value: 0000 0000 (00h) this is an 8-bit register that contains the low part of the value to be compared to the clr register. counter high register (chr) read only reset value: 1111 1111 (ffh) this is an 8-bit register that contains the high part of the counter value. counter low register (clr) read only reset value: 1111 1100 (fch) this is an 8-bit register that contains the low part of the counter value. a write to this register resets the counter. an access to this register after accessing the sr register clears the tof bit. alternate counter high register (achr) read only reset value: 1111 1111 (ffh) this is an 8-bit register that contains the high part of the counter value. alternate counter low register (aclr) read only reset value: 1111 1100 (fch) this is an 8-bit register that contains the low part of the counter value. a write to this register resets the counter. an access to this register after an access to sr register does not clear the tof bit in sr register. input capture 2 high register (ic2hr) read only reset value: undefined this is an 8-bit read only register that contains the high part of the counter value (transferred by the input capture 2 event). input capture 2 low register (ic2lr) read only reset value: undefined this is an 8-bit read only register that contains the low part of the counter value (transferred by the in- put capture 2 event). 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 70 msb lsb 51
52/101 st72e311 st72t311 16-bit timer (contd) table 16. 16-bit timer register map and reset values address (hex.) register name 76543210 timera: 32 timerb: 42 cr1 reset value icie 0 ocie 0 toie 0 folv2 0 folv1 0 olvl2 0 iedg1 0 olvl1 0 timera: 31 timerb: 41 cr2 reset value oc1e 0 oc2e 0 opm 0 pwm 0 cc1 0 cc0 0 iedg2 0 exedg 0 timera: 33 timerb: 43 sr reset value icf1 0 ocf1 0 tof 0 icf2 0 ocf2 0 - 0 - 0 - 0 timera: 34 timerb: 44 ic1hr reset value msb - ------ lsb - timera: 35 timerb: 45 ic1lr reset value msb - ------ lsb - timera: 36 timerb: 46 oc1hr reset value msb 1 - 0 - 0 - 0 - 0 - 0 - 0 lsb 0 timera: 37 timerb: 47 oc1lr reset value msb 0 - 0 - 0 - 0 - 0 - 0 - 0 lsb 0 timera: 3e timerb: 4e oc2hr reset value msb 1 - 0 - 0 - 0 - 0 - 0 - 0 lsb 0 timera: 3f timerb: 4f oc2lr reset value msb 0 - 0 - 0 - 0 - 0 - 0 - 0 lsb 0 timera: 38 timerb: 48 chr reset value msb 1111111 lsb 1 timera: 39 timerb: 49 clr reset value msb 1111110 lsb 0 timera: 3a timerb: 4a achr reset value msb 1111111 lsb 1 timera: 3b timerb: 4b aclr reset value msb 1111110 lsb 0 timera: 3c timerb: 4c ic2hr reset value msb - ------ lsb - timera: 3d timerb: 4d ic2lr reset value msb - ------ lsb - 52
53/101 st72e311 st72t311 5.4 serial communications interface (sci) 5.4.1 introduction the serial communications interface (sci) offers a flexible means of full-duplex data exchange with external equipment requiring an industry standard nrz asynchronous serial data format. the sci of- fers a very wide range of baud rates using two baud rate generator systems. 5.4.2 main features n full duplex, asynchronous communications n nrz standard format (mark/space) n dual baud rate generator systems n independently programmable transmit and receive baud rates up to 250k baud. n programmable data word length (8 or 9 bits) n receive buffer full, transmit buffer empty and end of transmission flags n two receiver wake-up modes: C address bit (msb) C idle line n muting function for multiprocessor configurations n separate enable bits for transmitter and receiver n three error detection flags: C overrun error C noise error C frame error n five interrupt sources with flags: C transmit data register empty C transmission complete C receive data register full C idle line received C overrun error detected 5.4.3 general description the interface is externally connected to another device by two pins (see figure 2.): C tdo: transmit data output. when the transmit- ter is disabled, the output pin returns to its i/o port configuration. when the transmitter is ena- bled and nothing is to be transmitted, the tdo pin is at high level. C rdi: receive data input is the serial data input. oversampling techniques are used for data re- covery by discriminating between valid incoming data and noise. through this pins, serial data is transmitted and re- ceived as frames comprising: C an idle line prior to transmission or reception C a start bit C a data word (8 or 9 bits) least significant bit first C a stop bit indicating that the frame is complete. this interface uses two types of baud rate generator: C a conventional type for commonly-used baud rates, C an extended type with a prescaler offering a very wide range of baud rates even with non-standard oscillator frequencies. 53
54/101 st72e311 st72t311 serial communications interface (contd) figure 34. sci block diagram wake up unit receiver control sr transmit control tdre tc rdrf idle or nf fe - sci control interrupt cr1 r8 t8 - m wake - -- received data register (rdr) received shift register read transmit data register (tdr) transmit shift register write rdi tdo (data register) dr transmitter clock receiver clock receiver rate transmitter rate brr scp1 f cpu control control scp0 sct2 sct1 sct0 scr2 scr1scr0 /2 /pr /16 conventional baud rate generator sbk rwu re te ilie rie tcie tie cr2 54
55/101 st72e311 st72t311 serial communications interface (contd) 5.4.4 functional description the block diagram of the serial control interface, is shown in figure 1.. it contains 6 dedicated reg- isters: C two control registers (cr1 & cr2) C a status register (sr) C a baud rate register (brr) C an extended prescaler receiver register (erpr) C an extended prescaler transmitter register (etpr) refer to the register descriptions in section 0.1.7 for the definitions of each bit. 5.4.4.1 serial data format word length may be selected as being either 8 or 9 bits by programming the m bit in the cr1 register (see figure 1.). the tdo pin is in low state during the start bit. the tdo pin is in high state during the stop bit. an idle character is interpreted as an entire frame of 1s followed by the start bit of the next frame which contains data. a break character is interpreted on receiving 0s for some multiple of the frame period. at the end of the last break frame the transmitter inserts an ex- tra 1 bit to acknowledge the start bit. transmission and reception are driven by their own baud rate generator. figure 35. word length programming bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 bit8 start bit stop bit next start bit idle frame bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 start bit stop bit next start bit start bit idle frame start bit 9-bit word length (m bit is set) 8-bit word length (m bit is reset) possible parity bit possible parity bit break frame start bit extra 1 data frame break frame start bit extra 1 data frame next data frame next data frame 55
56/101 st72e311 st72t311 serial communications interface (contd) 5.4.4.2 transmitter the transmitter can send data words of either 8 or 9 bits depending on the m bit status. when the m bit is set, word length is 9 bits and the 9th bit (the msb) has to be stored in the t8 bit in the cr1 reg- ister. character transmission during an sci transmission, data shifts out least significant bit first on the tdo pin. in this mode, the dr register consists of a buffer (tdr) between the internal bus and the transmit shift register (see figure 1.). procedure C select the m bit to define the word length. C select the desired baud rate using the brr and the etpr registers. C set the te bit to assign the tdo pin to the alter- nate function and to send a idle frame as first transmission. C access the sr register and write the data to send in the dr register (this sequence clears the tdre bit). repeat this sequence for each data to be transmitted. clearing the tdre bit is always performed by the following software sequence: 1. an access to the sr register 2. a write to the dr register the tdre bit is set by hardware and it indicates: C the tdr register is empty. C the data transfer is beginning. C the next data can be written in the dr register without overwriting the previous data. this flag generates an interrupt if the tie bit is set and the i bit is cleared in the ccr register. when a transmission is taking place, a write in- struction to the dr register stores the data in the tdr register and which is copied in the shift regis- ter at the end of the current transmission. when no transmission is taking place, a write in- struction to the dr register places the data directly in the shift register, the data transmission starts, and the tdre bit is immediately set. when a frame transmission is complete (after the stop bit or after the break frame) the tc bit is set and an interrupt is generated if the tcie is set and the i bit is cleared in the ccr register. clearing the tc bit is performed by the following software sequence: 1. an access to the sr register 2. a write to the dr register note: the tdre and tc bits are cleared by the same software sequence. break characters setting the sbk bit l oads the shift register with a break character. the break frame length depends on the m bit (see figure 2.). as long as the sbk bit is set, the sci send break frames to the tdo pin. after clearing this bit by software the sci insert a logic 1 bit at the end of the last break frame to guarantee the recognition of the start bit of the next frame. idle characters setting the te bit drives the sci to send an idle frame before the first data frame. clearing and then setting the te bit during a trans- mission sends an idle frame after the current word. note: resetting and setting the te bit causes the data in the tdr register to be lost. therefore the best time to toggle the te bit is when the tdre bit is set i.e. before writing the next byte in the dr. 56
57/101 st72e311 st72t311 serial communications interface (contd) 5.4.4.3 receiver the sci can receive data words of either 8 or 9 bits. when the m bit is set, word length is 9 bits and the msb is stored in the r8 bit in the cr1 reg- ister. character reception during a sci reception, data shifts in least signifi- cant bit first through the rdi pin. in this mode, dr register consists in a buffer (rdr) between the in- ternal bus and the received shift register (see fig- ure 1.). procedure C select the m bit to define the word length. C select the desired baud rate using the brr and the erpr registers. C set the re bit, this enables the receiver which begins searching for a start bit. when a character is received: C the rdrf bit is set. it indicates that the content of the shift register is transferred to the rdr. C an interrupt is generated if the rie bit is set and the i bit is cleared in the ccr register. C the error flags can be set if a frame error, noise or an overrun error has been detected during re- ception. clearing the rdrf bit is performed by the following software sequence done by: 1. an access to the sr register 2. a read to the dr register. the rdrf bit must be cleared before the end of the reception of the next character to avoid an overrun error. break character when a break character is received, the sci han- dles it as a framing error. idle character when a idle frame is detected, there is the same procedure as a data received character plus an in- terrupt if the ilie bit is set and the i bit is cleared in the ccr register. overrun error an overrun error occurs when a character is re- ceived when rdrf has not been reset. data can not be transferred from the shift register to the tdr register as long as the rdrf bit is not cleared. when a overrun error occurs: C the or bit is set. C the rdr content will not be lost. C the shift register will be overwritten. C an interrupt is generated if the rie bit is set and the i bit is cleared in the ccr register. the or bit is reset by an access to the sr register followed by a dr register read operation. noise error oversampling techniques are used for data recov- ery by discriminating between valid incoming data and noise. when noise is detected in a frame: C the nf is set at the rising edge of the rdrf bit. C data is transferred from the shift register to the dr register. C no interrupt is generated. however this bit rises at the same time as the rdrf bit which itself generates an interrupt. the nf bit is reset by a sr register read operation followed by a dr register read operation. framing error a framing error is detected when: C the stop bit is not recognized on reception at the expected time, following either a de-synchroni- zation or excessive noise. C a break is received. when the framing error is detected: C the fe bit is set by hardware C data is transferred from the shift register to the dr register. C no interrupt is generated. however this bit rises at the same time as the rdrf bit which itself generates an interrupt. the fe bit is reset by a sr register read operation followed by a dr register read operation. 57
58/101 st72e311 st72t311 serial communications interface (contd) figure 36. sci baud rate and extended prescaler block diagram transmitter receiver etpr erpr extended prescaler receiver rate control extended prescaler transmitter rate control extended prescaler clock clock receiver rate transmitter rate brr scp1 f cpu control control scp0 sct2 sct1 sct0 scr2 scr1scr0 /2 /pr /16 conventional baud rate generator extended receiver prescaler register extended transmitter prescaler register 58
59/101 st72e311 st72t311 serial communications interface (contd) 5.4.4.4 conventional baud rate generation the baud rate for the receiver and transmitter (rx and tx) are set independently and calculated as follows: with: pr = 1, 3, 4 or 13 (see scp0 & scp1 bits) tr = 1, 2, 4, 8, 16, 32, 64,128 (see sct0, sct1 & sct2 bits) rr = 1, 2, 4, 8, 16, 32, 64,128 (see scr0,scr1 & scr2 bits) all this bits are in the brr register. example: if f cpu is 8 mhz (normal mode) and if pr=13 and tr=rr=1, the transmit and receive baud rates are 19200 baud. note: the baud rate registers must not be changed while the transmitter or the receiver is en- abled. 5.4.4.5 extended baud rate generation the extended prescaler option gives a very fine tuning on the baud rate, using a 255 value prescal- er, whereas the conventional baud rate genera- tor retains industry standard software compatibili- ty. the extended baud rate generator block diagram is described in the figure 3.. the output clock rate sent to the transmitter or to the receiver will be the output from the 16 divider divided by a factor ranging from 1 to 255 set in the erpr or the etpr register. note: the extended prescaler is activated by set- ting the etpr or erpr register to a value other than zero. the baud rates are calculated as fol- lows: with: etpr = 1,..,255 (see etpr register) erpr = 1,.. 255 (see erpr register) 5.4.4.6 receiver muting and wake-up feature in multiprocessor configurations it is often desira- ble that only the intended message recipient should actively receive the full message contents, thus reducing redundant sci service overhead for all non addressed receivers. the non addressed devices may be placed in sleep mode by means of the muting function. setting the rwu bit by software puts the sci in sleep mode: all the reception status bits can not be set. all the receive interrupt are inhibited. a muted receiver may be awakened by one of the following two ways: C by idle line detection if the wake bit is reset, C by address mark detection if the wake bit is set. receiver wakes-up by idle line detection when the receive line has recognised an idle frame. then the rwu bit is reset by hardware but the idle bit is not set. receiver wakes-up by address mark detection when it received a 1 as the most significant bit of a word, thus indicating that the message is an ad- dress. the reception of this particular word wakes up the receiver, resets the rwu bit and sets the rdrf bit, which allows the receiver to receive this word normally and to use it as an address word. tx = (32 * pr) * tr f cpu rx = (32 * pr) * rr f cpu tx = 16 * etpr f cpu rx = 16 * erpr f cpu 59
60/101 st72e311 st72t311 serial communications interface (contd) 5.4.5 low power modes 5.4.6 interrupts the sci interrupt events are connected to the same interrupt vector (see interrupts chapter). these events generate an interrupt if the corre- sponding enable control bit is set and the inter- rupt mask in the cc register is reset (rim instruc- tion). mode description wait no effect on sci. sci interrupts cause the device to exit from wait mode. halt sci registers are frozen. in halt mode, the sci stops transmitting/receiving until halt mode is exited. interrupt event event flag enable control bit exit from wait exit from halt transmit data register empty tdre tie yes no transmission complete tc tcie yes no received data ready to be read rdrf rie yes no overrrun error detected or yes no idle line detected idle ilie yes no 60
61/101 st72e311 st72t311 serial communications interface (contd) 5.4.7 register description status register (sr) read only reset value: 1100 0000 (c0h) bit 7 = tdre transmit data register empty. this bit is set by hardware when the content of the tdr register has been transferred into the shift register. an interrupt is generated if the tie =1 in the cr2 register. it is cleared by a software se- quence (an access to the sr register followed by a write to the dr register). 0: data is not transferred to the shift register 1: data is transferred to the shift register note : data will not be transferred to the shift regis- ter as long as the tdre bit is not reset. bit 6 = tc transmission complete. this bit is set by hardware when transmission of a frame containing data, a preamble or a break is complete. an interrupt is generated if tcie=1 in the cr2 register. it is cleared by a software se- quence (an access to the sr register followed by a write to the dr register). 0: transmission is not complete 1: transmission is complete bit 5 = rdrf received data ready flag. this bit is set by hardware when the content of the rdr register has been transferred into the dr register. an interrupt is generated if rie=1 in the cr2 register. it is cleared by a software sequence (an access to the sr register followed by a read to the dr register). 0: data is not received 1: received data is ready to be read bit 4 = idle idle line detect. this bit is set by hardware when a idle line is de- tected. an interrupt is generated if the ilie=1 in the cr2 register. it is cleared by a software se- quence (an access to the sr register followed by a read to the dr register). 0: no idle line is detected 1: idle line is detected note: the idle bit will not be set again until the rdrf bit has been set itself (i.e. a new idle line oc- curs). this bit is not set by an idle line when the re- ceiver wakes up from wake-up mode. bit 3 = or overrun error. this bit is set by hardware when the word currently being received in the shift register is ready to be transferred into the rdr register while rdrf=1. an interrupt is generated if rie=1 in the cr2 reg- ister. it is cleared by a software sequence (an ac- cess to the sr register followed by a read to the dr register). 0: no overrun error 1: overrun error is detected note: when this bit is set rdr register content will not be lost but the shift register will be overwritten. bit 2 = nf noise flag. this bit is set by hardware when noise is detected on a received frame. it is cleared by a software se- quence (an access to the sr register followed by a read to the dr register). 0: no noise is detected 1: noise is detected note: this bit does not generate interrupt as it ap- pears at the same time as the rdrf bit which it- self generates an interrupt. bit 1 = fe framing error. this bit is set by hardware when a de-synchroniza- tion, excessive noise or a break character is de- tected. it is cleared by a software sequence (an access to the sr register followed by a read to the dr register). 0: no framing error is detected 1: framing error or break character is detected note: this bit does not generate interrupt as it ap- pears at the same time as the rdrf bit which it- self generates an interrupt. if the word currently being transferred causes both frame error and overrun error, it will be transferred and only the or bit will be set. bit 0 = unused. 70 tdre tc rdrf idle or nf fe - 61
62/101 st72e311 st72t311 serial communications interface (contd) control register 1 (cr1) read/write reset value: undefined bit 7 = r8 receive data bit 8. this bit is used to store the 9th bit of the received word when m=1. bit 6 = t8 transmit data bit 8. this bit is used to store the 9th bit of the transmit- ted word when m=1. bit 4 = m word length. this bit determines the word length. it is set or cleared by software. 0: 1 start bit, 8 data bits, 1 stop bit 1: 1 start bit, 9 data bits, 1 stop bit bit 3 = wake wake-up method. this bit determines the sci wake-up method, it is set or cleared by software. 0: idle line 1: address mark control register 2 (cr2) read/write reset value: 0000 0000 (00h) bit 7 = tie transmitter interrupt enable . this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever tdre=1 in the sr register. bit 6 = tcie transmission complete interrupt ena- ble this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever tc=1 in the sr register bit 5 = rie receiver interrupt enable . this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever or=1 or rdrf=1 in the sr register bit 4 = ilie idle line interrupt enable. this bit is set and cleared by software. 0: interrupt is inhibited 1: an sci interrupt is generated whenever idle=1 in the sr register. bit 3 = te transmitter enable. this bit enables the transmitter and assigns the tdo pin to the alternate function. it is set and cleared by software. 0: transmitter is disabled, the tdo pin is back to the i/o port configuration. 1: transmitter is enabled note: during transmission, a 0 pulse on the te bit (0 followed by 1) sends a preamble after the current word. bit 2 = re receiver enable. this bit enables the receiver. it is set and cleared by software. 0: receiver is disabled. 1: receiver is enabled and begins searching for a start bit. bit 1 = rwu receiver wake-up. this bit determines if the sci is in mute mode or not. it is set and cleared by software and can be cleared by hardware when a wake-up sequence is recognized. 0: receiver in active mode 1: receiver in mute mode bit 0 = sbk send break. this bit set is used to send break characters. it is set and cleared by software. 0: no break character is transmitted 1: break characters are transmitted note: if the sbk bit is set to 1 and then to 0, the transmitter will send a br eak word at the end of the current word. 70 r8 t8 - m wake - - - 70 tie tcie rie ilie te re rwu sbk 62
63/101 st72e311 st72t311 serial communications interface (contd) data register (dr) read/write reset value: undefined contains the received or transmitted data char- acter, depending on whether it is read from or writ- ten to. the data register performs a double function (read and write) since it is composed of two registers, one for transmission (tdr) and one for reception (rdr). the tdr register provides the parallel interface between the internal bus and the output shift reg- ister (see figure 1.). the rdr register provides the parallel interface between the input shift register and the internal bus (see figure 1.). baud rate register (brr) read/write reset value: 00xx xxxx (xxh) bit 7:6= scp[1:0] first sci prescaler these 2 prescaling bits allow several standard clock division ranges: bit 5:3 = sct[2:0] sci transmitter rate divisor these 3 bits, in conjunction with the scp1 & scp0 bits define the total division applied to the bus clock to yield the transmit rate clock in convention- al baud rate generator mode. note: this tr factor is used only when the etpr fine tuning factor is equal to 00h; otherwise, tr is replaced by the etpr dividing factor. bit 2:0 = scr[2:0] sci receiver rate divisor. these 3 bits, in conjunction with the scp1 & scp0 bits define the total division applied to the bus clock to yield the receive rate clock in conventional baud rate generator mode. note: this rr factor is used only when the erpr fine tuning factor is equal to 00h; otherwise, rr is replaced by the erpr dividing factor. 70 dr7 dr6 dr5 dr4 dr3 dr2 dr1 dr0 70 scp1 scp0 sct2 sct1 sct0 scr2 scr1 scr0 pr prescaling factor scp1 scp0 100 301 410 13 1 1 tr dividing factor sct2 sct1 sct0 1 000 2 001 4 010 8 011 16 100 32 101 64 110 128 1 1 1 rr dividing factor scr2 scr1 scr0 1 000 2 001 4 010 8 011 16 100 32 101 64 110 128 1 1 1 63
64/101 st72e311 st72t311 serial communications interface (contd) extended receive prescaler division register (erpr) read/write reset value: 0000 0000 (00h) allows setting of the extended prescaler rate divi- sion factor for the receive circuit. bit 7:1 = erpr[7:0] 8-bit extended receive pres- caler register. the extended baud rate generator is activated when a value different from 00h is stored in this register. therefore the clock frequency issued from the 16 divider (see figure 3.) is divided by the binary factor set in the erpr register (in the range 1 to 255). the extended baud rate generator is not used af- ter a reset. extended transmit prescaler division register (etpr) read/write reset value:0000 0000 (00h) allows setting of the external prescaler rate divi- sion factor for the transmit circuit. bit 7:1 = etpr[7:0] 8-bit extended transmit pres- caler register. the extended baud rate generator is activated when a value different from 00h is stored in this register. therefore the clock frequency issued from the 16 divider (see figure 3.) is divided by the binary factor set in the etpr register (in the range 1 to 255). the extended baud rate generator is not used af- ter a reset. table 17. sci register map and reset values 70 erpr 7 erpr 6 erpr 5 erpr 4 erpr 3 erpr 2 erpr 1 erpr 0 70 etpr 7 etpr 6 etpr 5 etpr 4 etpr 3 etpr 2 etpr 1 etpr 0 address (hex.) register name 76543210 50 sr reset value tdre 1 tc 1 rdrf 0 idle 0 or 0 nf 0 fe 0 - 0 51 dr reset value dr7 - dr6 - dr5 - dr4 - dr3 - dr2 - dr1 - dr0 - 52 brr reset value scp1 0 scp0 0 sct2 x sct1 x sct0 x scr2 x scr1 x scr0 x 53 cr1 reset value r8 - t8 -- m - wake ---- 54 cr2 reset value tie 0 tcie 0 rie 0 ilie 0 te 0 re 0 rwu 0 sbk 0 55 erpr reset value erpr7 0 erpr6 0 erpr5 0 erpr4 0 erpr3 0 erpr2 0 erpr1 0 erpr0 0 57 etpr reset value etpr7 0 etpr6 0 etpr5 0 etpr4 0 etpr3 0 etpr2 0 etpr1 0 etpr0 0 64
65/101 st72e311 st72t311 5.5 serial peripheral interface (spi) 5.5.1 introduction the serial peripheral interface (spi) allows full- duplex, synchronous, serial communication with external devices. an spi system may consist of a master and one or more slaves or a system in which devices may be either masters or slaves. the spi is normally used for communication be- tween the microcontroller and external peripherals or another microcontroller. refer to the pin description chapter for the device- specific pin-out. 5.5.2 main features n full duplex, three-wire synchronous transfers n master or slave operation n four master mode frequencies n maximum slave mode frequency = fcpu/2. n four programmable master bit rates n programmable clock polarity and phase n end of transfer interrupt flag n write collision flag protection n master mode fault protection capability. 5.5.3 general description the spi is connected to external devices through 4 alternate pins: C miso: master in slave out pin C mosi: master out slave in pin C sck: serial clock pin Css : slave select pin a basic example of interconnections between a single master and a single slave is illustrated on figure 1 . the mosi pins are connected together as are miso pins. in this way data is transferred serially between master and slave (most significant bit first). when the master device transmits data to a slave device via mosi pin, the slave device responds by sending data to the master device via the miso pin. this implies full duplex transmission with both data out and data in synchronized with the same clock signal (which is provided by the master de- vice via the sck pin). thus, the byte transmitted is replaced by the byte received and eliminates the need for separate transmit-empty and receiver-full bits. a status flag is used to indicate that the i/o operation is com- plete. four possible data/clock timing relationships may be chosen (see figure 4 ) but master and slave must be programmed with the same timing mode. figure 37. serial peripheral interface master/slave 8-bit shift register spi clock generator 8-bit shift register miso mosi mosi miso sck sck slave master ss ss +5v msbit lsbit msbit lsbit 65
66/101 st72e311 st72t311 serial peripheral interface (contd) figure 38. serial peripheral interface block diagram dr read buffer 8-bit shift register write read internal bus spi spie spe spr2 mstr cpha spr0 spr1 cpol spif wcol modf serial clock generator mosi miso ss sck control state cr sr - -- -- it request master control 66
67/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4 functional description figure 1 shows the serial peripheral interface (spi) block diagram. this interface contains 3 dedicated registers: C a control register (cr) C a status register (sr) C a data register (dr) refer to the cr, sr and dr registers in section 0.1.7 for the bit definitions. 5.5.4.1 master configuration in a master configuration, the serial clock is gener- ated on the sck pin. procedure C select the spr0 & spr1 bits to define the se- rial clock baud rate (see cr register). C select the cpol and cpha bits to define one of the four relationships between the data transfer and the serial clock (see figure 4 ). Cthe ss pin must be connected to a high level signal during the complete byte transmit se- quence. C the mstr and spe bits must be set (they re- main set only if the ss pin is connected to a high level signal). in this configuration the mosi pin is a data output and to the miso pin is a data input. transmit sequence the transmit sequence begins when a byte is writ- ten the dr register. the data byte is parallel loaded into the 8-bit shift register (from the internal bus) during a write cycle and then shifted out serially to the mosi pin most significant bit first. when data transfer is complete: C the spif bit is set by hardware C an interrupt is generated if the spie bit is set and the i bit in the ccr register is cleared. during the last clock cycle the spif bit is set, a copy of the data byte received in the shift register is moved to a buffer. when the dr register is read, the spi peripheral returns this buffered value. clearing the spif bit is performed by the following software sequence: 1. an access to the sr register while the spif bit is set 2. a read to the dr register. note: while the spif bit is set, all writes to the dr register are inhibited until the sr register is read. 67
68/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4.2 slave configuration in slave configuration, the serial clock is received on the sck pin from the master device. the value of the spr0 & spr1 bits is not used for the data transfer. procedure C for correct data transfer, the slave device must be in the same timing mode as the mas- ter device (cpol and cpha bits). see figure 4 . Cthe ss pin must be connected to a low level signal during the complete byte transmit se- quence. C clear the mstr bit and set the spe bit to as- sign the pins to alternate function. in this configuration the mosi pin is a data input and the miso pin is a data output. transmit sequence the data byte is parallel loaded into the 8-bit shift register (from the internal bus) during a write cycle and then shifted out serially to the miso pin most significant bit first. the transmit sequence begins when the slave de- vice receives the clock signal and the most signifi- cant bit of the data on its mosi pin. when data transfer is complete: C the spif bit is set by hardware C an interrupt is generated if spie bit is set and i bit in ccr register is cleared. during the last clock cycle the spif bit is set, a copy of the data byte received in the shift register is moved to a buffer. when the dr register is read, the spi peripheral returns this buffered value. clearing the spif bit is performed by the following software sequence: 1. an access to the sr register while the spif bit is set. 2.a read to the dr register. notes: while the spif bit is set, all writes to the dr register are inhibited until the sr register is read. the spif bit can be cleared during a second transmission; however, it must be cleared before the second spif bit in order to prevent an overrun condition (see section 0.1.4.6 ). depending on the cpha bit, the ss pin has to be set to write to the dr register between each data byte transfer to avoid a write collision (see section 0.1.4.4 ). 68
69/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4.3 data transfer format during an spi transfer, data is simultaneously transmitted (shifted out serially) and received (shifted in serially). the serial clock is used to syn- chronize the data transfer during a sequence of eight clock pulses. the ss pin allows individual selection of a slave device; the other slave devices that are not select- ed do not interfere with the spi transfer. clock phase and clock polarity four possible timing relationships may be chosen by software, using the cpol and cpha bits. the cpol (clock polarity) bit controls the steady state value of the clock when no data is being transferred. this bit affects both master and slave modes. the combination between the cpol and cpha (clock phase) bits selects the data capture clock edge. figure 4 , shows an spi transfer with the four com- binations of the cpha and cpol bits. the dia- gram may be interpreted as a master or slave tim- ing diagram where the sck pin, the miso pin, the mosi pin are directly connected between the mas- ter and the slave device. the ss pin is the slave device select input and can be driven by the master device. the master device applies data to its mosi pin- clock edge before the capture clock edge. cpha bit is set the second edge on the sck pin (falling edge if the cpol bit is reset, rising edge if the cpol bit is set) is the msbit capture strobe. data is latched on the occurrence of the second clock transition. no write collision should occur even if the ss pin stays low during a transfer of several bytes (see figure 3 ). cpha bit is reset the first edge on the sck pin (falling edge if cpol bit is set, rising edge if cpol bit is reset) is the msbit capture strobe. data is latched on the oc- currence of the first clock transition. the ss pin must be toggled high and low between each byte transmitted (see figure 3 ). to protect the transmission from a write collision a low value on the ss pin of a slave device freezes the data in its dr register and does not allow it to be altered. therefore the ss pin must be high to write a new data byte in the dr without producing a write collision. figure 39. cpha / ss timing diagram mosi/miso master ss slave ss (cpha=0) slave ss (cpha=1) byte 1 byte 2 byte 3 vr02131a 69
70/101 st72e311 st72t311 serial peripheral interface (contd) figure 40. data clock timing diagram cpol = 1) cpol = 0) miso (from master) mosi (from slave) ss (to slave) capture strobe cpha =1 cpol = 1 cpol = 0 msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit miso (from master) mosi ss (to slave) capture strobe cpha =0 note: this figure should not be used as a replacement for parametric information. refer to the electrical characteristics chapter. (from slave) vr02131b msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit msbit bit 6 bit 5 bit 4 bit3 bit 2 bit 1 lsbit sclk (with sclk (with 70
71/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4.4 write collision error a write collision occurs when the software tries to write to the dr register while a data transfer is tak- ing place with an external device. when this hap- pens, the transfer continues uninterrupted; and the software write will be unsuccessful. write collisions can occur both in master and slave mode. note: a "read collision" will never occur since the received data byte is placed in a buffer in which access is always synchronous with the mcu oper- ation. in slave mode when the cpha bit is set: the slave device will receive a clock (sck) edge prior to the latch of the first data transfer. this first clock edge will freeze the data in the slave device dr register and output the msbit on to the exter- nal miso pin of the slave device. the ss pin low state enables the slave device but the output of the msbit onto the miso pin does not take place until the first data transfer clock edge. when the cpha bit is reset: data is latched on the occurrence of the first clock transition. the slave device does not have any way of knowing when that transition will occur; therefore, the slave device collision occurs when software attempts to write the dr register after its ss pin has been pulled low. for this reason, the ss pin must be high, between each data byte transfer, to allow the cpu to write in the dr register without generating a write colli- sion. in master mode collision in the master device is defined as a write of the dr register while the internal serial clock (sck) is in the process of transfer. the ss pin signal must be always high on the master device. wcol bit the wcol bit in the sr register is set if a write collision occurs. no spi interrupt is generated when the wcol bit is set (the wcol bit is a status flag only). clearing the wcol bit is done through a software sequence (see figure 5 ). figure 41. clearing the wcol bit (write collision flag) software sequence clearing sequence after spif = 1 (end of a data byte transfer) 1st step read sr read dr write dr 2nd step spif =0 wcol=0 spif =0 wcol=0 if no transfer has started wcol=1 if a transfer has started clearing sequence before spif = 1 (during a data byte transfer) 1st step 2nd step wcol=0 before the 2nd step read sr read dr note: writing in dr register in- stead of reading in it do not reset wcol bit read sr or then then then 71
72/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4.5 master mode fault master mode fault occurs when the master device has its ss pin pulled low, then the modf bit is set. master mode fault affects the spi peripheral in the following ways: C the modf bit is set and an spi interrupt is generated if the spie bit is set. C the spe bit is reset. this blocks all output from the device and disables the spi periph- eral. C the mstr bit is reset, thus forcing the device into slave mode. clearing the modf bit is done through a software sequence: 1. a read or write access to the sr register while the modf bit is set. 2. a write to the cr register. notes: to avoid any multiple slave conflicts in the case of a system comprising several mcus, the ss pin must be pulled high during the clearing se- quence of the modf bit. the spe and mstr bits may be restored to their original state during or af- ter this clearing sequence. hardware does not allow the user to set the spe and mstr bits while the modf bit is set except in the modf bit clearing sequence. in a slave device the modf bit can not be set, but in a multi master configuration the device can be in slave mode with this modf bit set. the modf bit indicates that there might have been a multi-master conflict for system control and allows a proper exit from system operation to a re- set or default system state using an interrupt rou- tine. 5.5.4.6 overrun condition an overrun condition occurs when the master de- vice has sent several data bytes and the slave de- vice has not cleared the spif bit issuing from the previous data byte transmitted. in this case, the receiver buffer contains the byte sent after the spif bit was last cleared. a read to the dr register returns this byte. all other bytes are lost. this condition is not detected by the spi peripher- al. 72
73/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.4.7 single master and multimaster configurations there are two types of spi systems: C single master system C multimaster system single master system a typical single master system may be configured, using an mcu as the master and four mcus as slaves (see figure 6 ). the master device selects the individual slave de- vices by using four pins of a parallel port to control the four ss pins of the slave devices. the ss pins are pulled high during reset since the master device ports will be forced to be inputs at that time, thus disabling the slave devices. note: to prevent a bus conflict on the miso line the master allows only one active slave device during a transmission. for more security, the slave device may respond to the master with the received data byte. then the master will receive the previous byte back from the slave device if all miso and mosi pins are con- nected and the slave has not written its dr regis- ter. other transmission security methods can use ports for handshake lines or data bytes with com- mand fields. multi-master system a multi-master system may also be configured by the user. transfer of master control could be im- plemented using a handshake method through the i/o ports or by an exchange of code messages through the serial peripheral interface system. the multi-master system is principally handled by the mstr bit in the cr register and the modf bit in the sr register. figure 42. single master configuration miso mosi mosi mosi mosi mosi miso miso miso miso ss ss ss ss ss sck sck sck sck sck 5v ports slave mcu slave mcu slave mcu slave mcu master mcu 73
74/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.5 low power modes 5.5.6 interrupts note : the spi interrupt events are connected to the same interrupt vector (see interrupts chapter). they generate an interrupt if the corresponding enable control bit is set and the interrupt mask in the cc register is reset (rim instruction). mode description wait no effect on spi. spi interrupt events cause the device to exit from wait mode. halt spi registers are frozen. in halt mode, the spi is inactive. spi operation resumes when the mcu is woken up by an interrupt with exit from halt mode capability. interrupt event event flag enable control bit exit from wait exit from halt spi end of transfer event spif spie yes no master mode fault event modf yes no 74
75/101 st72e311 st72t311 serial peripheral interface (contd) 5.5.7 register description control register (cr) read/write reset value: 0000xxxx (0xh) bit 7 = spie serial peripheral interrupt enable. this bit is set and cleared by software. 0: interrupt is inhibited 1: an spi interrupt is generated whenever spif=1 or modf=1 in the sr register bit 6 = spe serial peripheral output enable. this bit is set and cleared by software. it is also cleared by hardware when, in master mode, ss =0 (see section 0.1.4.5 master mode fault ). 0: i/o port connected to pins 1: spi alternate functions connected to pins the spe bit is cleared by reset, so the spi periph- eral is not initially connected to the external pins. bit 5 = spr2 divider enable . this bit is set and cleared by software and it is cleared by reset. it is used with the spr[1:0] bits to set the baud rate. refer to table 1 . 0: divider by 2 enabled 1: divider by 2 disabled bit 4 = mstr master. this bit is set and cleared by software. it is also cleared by hardware when, in master mode, ss =0 (see section 0.1.4.5 master mode fault ). 0: slave mode is selected 1: master mode is selected, the function of the sck pin changes from an input to an output and the functions of the miso and mosi pins are re- versed. bit 3 = cpol clock polarity. this bit is set and cleared by software. this bit de- termines the steady state of the serial clock. the cpol bit affects both the master and slave modes. 0: the steady state is a low value at the sck pin. 1: the steady state is a high value at the sck pin. bit 2 = cpha clock phase. this bit is set and cleared by software. 0: the first clock transition is the first data capture edge. 1: the second clock transition is the first capture edge. bit 1:0 = spr[1 : 0] serial peripheral rate. these bits are set and cleared by software.used with the spr2 bit, they select one of six baud rates to be used as the serial clock when the device is a master. these 2 bits have no effect in slave mode. table 18. serial peripheral baud rate 70 spie spe spr2 mstr cpol cpha spr1 spr0 serial clock spr2 spr1 spr0 f cpu /4 1 0 0 f cpu /8 0 0 0 f cpu /16 0 0 1 f cpu /32 1 1 0 f cpu /64 0 1 0 f cpu /128 0 1 1 75
76/101 st72e311 st72t311 serial peripheral interface (contd) status register (sr) read only reset value: 0000 0000 (00h) bit 7 = spif serial peripheral data transfer flag. this bit is set by hardware when a transfer has been completed. an interrupt is generated if spie=1 in the cr register. it is cleared by a soft- ware sequence (an access to the sr register fol- lowed by a read or write to the dr register). 0: data transfer is in progress or has been ap- proved by a clearing sequence. 1: data transfer between the device and an exter- nal device has been completed. note: while the spif bit is set, all writes to the dr register are inhibited. bit 6 = wcol write collision status. this bit is set by hardware when a write to the dr register is done during a transmit sequence. it is cleared by a software sequence (see figure 5 ). 0: no write collision occurred 1: a write collision has been detected bit 5 = unused. bit 4 = modf mode fault flag. this bit is set by hardware when the ss pin is pulled low in master mode (see section 0.1.4.5 master mode fault ). an spi interrupt can be gen- erated if spie=1 in the cr register. this bit is cleared by a software sequence (an access to the sr register while modf=1 followed by a write to the cr register). 0: no master mode fault detected 1: a fault in master mode has been detected bits 3-0 = unused. data i/o register (dr) read/write reset value: undefined the dr register is used to transmit and receive data on the serial bus. in the master device only a write to this register will initiate transmission/re- ception of another byte. notes: during the last clock cycle the spif bit is set, a copy of the received data byte in the shift register is moved to a buffer. when the user reads the serial peripheral data i/o register, the buffer is actually being read. warning: a write to the dr register places data directly into the shift register for transmission. a write to the the dr register returns the value lo- cated in the buffer and not the contents of the shift register (see figure 2 ). 70 spifwcol-modf---- 70 d7 d6 d5 d4 d3 d2 d1 d0 76
77/101 st72e311 st72t311 table 19. spi register map and reset values address (hex.) register name 76543210 21 dr reset value d7 x d6 x d5 x d4 x d3 x d2 x d1 x d0 x 22 cr reset value spie 0 spe 0 spr2 0 mstr 0 cpol x cpha x spr1 x spr0 x 23 sr reset value spif 0 wcol 0 - 0 modf 0 - 0 - 0 - 0 - 0 77
78/101 st72e311 st72t311 5.6 8-bit a/d converter (adc) 5.6.1 introduction the on-chip analog to digital converter (adc) pe- ripheral is a 8-bit, successive approximation con- verter with internal sample and hold circuitry. this peripheral has up to 8 multiplexed analog input channels (refer to device pin out description) that allow the peripheral to convert the analog voltage levels from up to 8 different sources. the result of the conversion is stored in a 8-bit data register. the a/d converter is controlled through a control/status register. 5.6.2 main features n 8-bit conversion n up to 8 channels with multiplexed input n linear successive approximation n data register (dr) which contains the results n conversion complete status flag n on/off bit (to reduce consumption) the block diagram is shown in figure 1 . figure 43. adc block diagram sample analog mux ain0 ain1 ain2 ain3 ain4 ain5 ain6 ain7 (control status register) csr (data register) dr & hold f cpu analog to digital converter coco 0ch0 ch1 ch2 - -adon ad7 ad4 ad0 ad1 ad2 ad3 ad6 ad5 78
79/101 st72e311 st72t311 8-bit a/d converter (adc) (contd) 5.6.3 functional description the high level reference voltage v dda must be connected externally to the v dd pin. the low level reference voltage v ssa must be connected exter- nally to the v ss pin. in some devices (refer to de- vice pin out description) high and low level refer- ence voltages are internally connected to the v dd and v ss pins. conversion accuracy may therefore be degraded by voltage drops and noise in the event of heavily loaded or badly decoupled power supply lines. figure 44. recommended ext. connections characteristics: the conversion is monotonic, meaning the result never decreases if the analog input does not and never increases if the analog input does not. if input voltage is greater than or equal to v dd (voltage reference high) then results = ffh (full scale) without overflow indication. if input voltage v ss (voltage reference low) then the results = 00h. the conversion time is 64 cpu clock cycles in- cluding a sampling time of 31.5 cpu clock cycles. r ain is the maximum recommended impedance for an analog input signal. if the impedance is too high, this will result in a loss of accuracy due to leakage and sampling not being completed in the alloted time. the a/d converter is linear and the digital result of the conversion is given by the formula: where reference voltage is v dd - v ss . the accuracy of the conversion is described in the electrical characteristics section. procedure: refer to the csr and dr register description sec- tion for the bit definitions. each analog input pin must be configured as input, no pull-up, no interrupt. refer to the i/o ports chapter. using these pins as analog inputs does not affect the ability of the port to be read as a logic input. in the csr register: C select the ch2 to ch0 bits to assign the ana- log channel to convert. refer to table 1 . C set the adon bit. then the a/d converter is enabled after a stabilization time (typically 30 s). it then performs a continuous conversion of the selected channel. when a conversion is complete C the coco bit is set by hardware. C no interrupt is generated. C the result is in the dr register. a write to the csr register aborts the current con- version, resets the coco bit and starts a new conversion. 5.6.4 low power modes note: the a/d converter may be disabled by re- setting the adon bit. this feature allows reduced power consumption when no conversion is need- ed. 5.6.5 interrupts none. st7 px.x/ainx v dda v ssa v dd 0.1f r ain v ain digital result = 255 x input voltage reference voltage mode description wait no effect on a/d converter halt a/d converter disabled. after wakeup from halt mode, the a/d converter requires a stabilisation time before accurate conversions can be performed. 79
80/101 st72e311 st72t311 8-bit a/d converter (adc) (contd) 5.6.6 register description control/status register (csr) read/write reset value: 0000 0000 (00h) bit 7 = coco conversion complete this bit is set by hardware. it is cleared by soft- ware reading the result in the dr register or writing to the csr register. 0: conversion is not complete. 1: conversion can be read from the dr register. bit 6 = reserved . must always be cleared. bit 5 = adon a/d converter on this bit is set and cleared by software. 0: a/d converter is switched off. 1: a/d converter is switched on. note : a typical 30 s delay time is necessary for the adc to stabilize when the adon bit is set. bit 4 = reserved . forced by hardware to 0. bit 3 = reserved . must always be cleared. bits 2:0: ch[2:0] channel selection these bits are set and cleared by software. they select the analog input to convert. table 20. channel selection * important note: the number of pins and the channel selection vary according to the device. refer to the device pinout). data register (dr) read only reset value: 0000 0000 (00h) bit 7:0 = ad[7:0] analog converted value this register contains the converted analog value in the range 00h to ffh. reading this register resets the coco flag. table 21. adc register map 70 coco - adon 0 - ch2 ch1 ch0 pin* ch2 ch1 ch0 ain0 000 ain1 001 ain2 010 ain3 011 ain4 100 ain5 101 ain6 110 ain7 111 70 ad7ad6ad5ad4ad3ad2ad1ad0 address (hex.) register name 765 4 3210 70 reset value dr ad7 0 ad6 0 ad5 0 ad4 0 ad3 0 ad2 0 ad1 0 ad0 0 71 reset value csr coco 0 - 0 adon 0 0 0 - 0 ch2 0 ch1 0 ch0 0 80
81/101 st72e311 st72t311 6 instruction set 6.1 st7 addressing modes the st7 core features 17 different addressing modes which can be classified in 7 main groups: the st7 instruction set is designed to minimize the number of bytes required per instruction: to do so, most of the addressing modes may be subdi- vided in two sub-modes called long and short: C long addressing mode is more powerful be- cause it can use the full 64 kbyte address space, however it uses more bytes and more cpu cy- cles. C short addressing mode is less powerful because it can generally only access page zero (0000h - 00ffh range), but the instruction size is more compact, and faster. all memory to memory in- structions use short addressing modes only (clr, cpl, neg, bset, bres, btjt, btjf, inc, dec, rlc, rrc, sll, srl, sra, swap) the st7 assembler optimizes the use of long and short addressing modes. table 22. st7 addressing mode overview note 1. at the time the instruction is executed, the program counter (pc) points to the instruction follow- ing jrxx. addressing mode example inherent nop immediate ld a,#$55 direct ld a,$55 indexed ld a,($55,x) indirect ld a,([$55],x) relative jrne loop bit operation bset byte,#5 mode syntax destination/ source pointer address (hex.) pointer size (hex.) length (bytes) inherent nop + 0 immediate ld a,#$55 + 1 short direct ld a,$10 00..ff + 1 long direct ld a,$1000 0000..ffff + 2 no offset direct indexed ld a,(x) 00..ff + 0 (with x register) + 1 (with y register) short direct indexed ld a,($10,x) 00..1fe + 1 long direct indexed ld a,($1000,x) 0000..ffff + 2 short indirect ld a,[$10] 00..ff 00..ff byte + 2 long indirect ld a,[$10.w] 0000..ffff 00..ff word + 2 short indirect indexed ld a,([$10],x) 00..1fe 00..ff byte + 2 long indirect indexed ld a,([$10.w],x) 0000..ffff 00..ff word + 2 relative direct jrne loop pc-128/pc+127 1) + 1 relative indirect jrne [$10] pc-128/pc+127 1) 00..ff byte + 2 bit direct bset $10,#7 00..ff + 1 bit indirect bset [$10],#7 00..ff 00..ff byte + 2 bit direct relative btjt $10,#7,skip 00..ff + 2 bit indirect relative btjt [$10],#7,skip 00..ff 00..ff byte + 3 81
82/101 st72e311 st72t311 st7 addressing modes (contd) 6.1.1 inherent all inherent instructions consist of a single byte. the opcode fully specifies all the required informa- tion for the cpu to process the operation. 6.1.2 immediate immediate instructions have two bytes, the first byte contains the opcode, the second byte con- tains the operand value. 6.1.3 direct in direct instructions, the operands are referenced by their memory address. the direct addressing mode consists of two sub- modes: direct (short) the address is a byte, thus requires only one byte after the opcode, but only allows 00 - ff address- ing space. direct (long) the address is a word, thus allowing 64 kbyte ad- dressing space, but requires 2 bytes after the op- code. 6.1.4 indexed (no offset, short, long) in this mode, the operand is referenced by its memory address, which is defined by the unsigned addition of an index register (x or y) with an offset. the indirect addressing mode consists of three sub-modes: indexed (no offset) there is no offset, (no extra byte after the opcode), and allows 00 - ff addressing space. indexed (short) the offset is a byte, thus requires only one byte af- ter the opcode and allows 00 - 1fe addressing space. indexed (long) the offset is a word, thus allowing 64 kbyte ad- dressing space and requires 2 bytes after the op- code. 6.1.5 indirect (short, long) the required data byte to do the operation is found by its memory address, located in memory (point- er). the pointer address follows the opcode. the indi- rect addressing mode consists of two sub-modes: indirect (short) the pointer address is a byte, the pointer size is a byte, thus allowing 00 - ff addressing space, and requires 1 byte after the opcode. indirect (long) the pointer address is a byte, the pointer size is a word, thus allowing 64 kbyte addressing space, and requires 1 byte after the opcode. inherent instruction function nop no operation trap s/w interrupt wfi wait for interrupt (low power mode) halt halt oscillator (lowest power mode) ret sub-routine return iret interrupt sub-routine return sim set interrupt mask rim reset interrupt mask scf set carry flag rcf reset carry flag rsp reset stack pointer ld load clr clear push/pop push/pop to/from the stack inc/dec increment/decrement tnz test negative or zero cpl, neg 1 or 2 complement mul byte multiplication sll, srl, sra, rlc, rrc shift and rotate operations swap swap nibbles immediate instruction function ld load cp compare bcp bit compare and, or, xor logical operations adc, add, sub, sbc arithmetic operations 82
83/101 st72e311 st72t311 st7 addressing modes (contd) 6.1.6 indirect indexed (short, long) this is a combination of indirect and short indexed addressing modes. the operand is referenced by its memory address, which is defined by the un- signed addition of an index register value (x or y) with a pointer value located in memory. the point- er address follows the opcode. the indirect indexed addressing mode consists of two sub-modes: indirect indexed (short) the pointer address is a byte, the pointer size is a byte, thus allowing 00 - 1fe addressing space, and requires 1 byte after the opcode. indirect indexed (long) the pointer address is a byte, the pointer size is a word, thus allowing 64 kbyte addressing space, and requires 1 byte after the opcode. table 23. instructions supporting direct, indexed, indirect and indirect indexed addressing modes 6.1.7 relative mode (direct, indirect) this addressing mode is used to modify the pc register value by adding an 8-bit signed offset to it. the relative addressing mode consists of two sub- modes: relative (direct) the offset follows the opcode. relative (indirect) the offset is defined in memory, of which the ad- dress follows the opcode. long and short instructions function ld load cp compare and, or, xor logical operations adc, add, sub, sbc arithmetic addition/subtrac- tion operations bcp bit compare short instructions only function clr clear inc, dec increment/decrement tnz test negative or zero cpl, neg 1 or 2 complement bset, bres bit operations btjt, btjf bit test and jump opera- tions sll, srl, sra, rlc, rrc shift and rotate operations swap swap nibbles call, jp call or jump subroutine available relative direct/ indirect instructions function jrxx conditional jump callr call relative 83
84/101 st72e311 st72t311 6.2 instruction groups the st7 family devices use an instruction set consisting of 63 instructions. the instructions may be subdivided into 13 main groups as illustrated in the following table: using a pre-byte the instructions are described with one to four bytes. in order to extend the number of available op- codes for an 8-bit cpu (256 opcodes), three differ- ent prebyte opcodes are defined. these prebytes modify the meaning of the instruction they pre- cede. the whole instruction becomes: pc-2 end of previous instruction pc-1 prebyte pc opcode pc+1 additional word (0 to 2) according to the number of bytes required to compute the effective address these prebytes enable instruction in y as well as indirect addressing modes to be implemented. they precede the opcode of the instruction in x or the instruction using direct addressing mode. the prebytes are: pdy 90 replace an x based instruction using immediate, direct, indexed, or inherent addressing mode by a y one. pix 92 replace an instruction using direct, di- rect bit, or direct relative addressing mode to an instruction using the corre- sponding indirect addressing mode. it also changes an instruction using x indexed addressing mode to an instruc- tion using indirect x indexed addressing mode. piy 91 replace an instruction using x indirect indexed addressing mode by a y one. load and transfer ld clr stack operation push pop rsp increment/decrement inc dec compare and tests cp tnz bcp logical operations and or xor cpl neg bit operation bset bres conditional bit test and branch btjt btjf arithmetic operations adc add sub sbc mul shift and rotates sll srl sra rlc rrc swap sla unconditional jump or call jra jrt jrf jp call callr nop ret conditional branch jrxx interruption management trap wfi halt iret code condition flag modification sim rim scf rcf 84
85/101 st72e311 st72t311 instruction groups (contd) mnemo description function/example dst src h i n z c adc add with carry a = a + m + c a m h n z c add addition a = a + m a m h n z c and logical and a = a . m a m n z bcp bit compare a, memory tst (a . m) a m n z bres bit reset bres byte, #3 m bset bit set bset byte, #3 m btjf jump if bit is false (0) btjf byte, #3, jmp1 m c btjt jump if bit is true (1) btjt byte, #3, jmp1 m c call call subroutine callr call subroutine relative clr clear reg, m 0 1 cp arithmetic compare tst(reg - m) reg m n z c cpl one complement a = ffh-a reg, m n z 1 dec decrement dec y reg, m n z halt halt 0 iret interrupt routine return pop cc, a, x, pc h i n z c inc increment inc x reg, m n z jp absolute jump jp [tbl.w] jra jump relative always jrt jump relative jrf never jump jrf * jrih jump if ext. interrupt = 1 jril jump if ext. interrupt = 0 jrh jump if h = 1 h = 1 ? jrnh jump if h = 0 h = 0 ? jrm jump if i = 1 i = 1 ? jrnm jump if i = 0 i = 0 ? jrmi jump if n = 1 (minus) n = 1 ? jrpl jump if n = 0 (plus) n = 0 ? jreq jump if z = 1 (equal) z = 1 ? jrne jump if z = 0 (not equal) z = 0 ? jrc jump if c = 1 c = 1 ? jrnc jump if c = 0 c = 0 ? jrult jump if c = 1 unsigned < jruge jump if c = 0 jmp if unsigned >= jrugt jump if (c + z = 0) unsigned > 85
86/101 st72e311 st72t311 instruction groups (contd) mnemo description function/example dst src h i n z c jrule jump if (c + z = 1) unsigned <= ld load dst <= src reg, m m, reg n z mul multiply x,a = x * a a, x, y x, y, a 0 0 neg negate (2's compl) neg $10 reg, m n z c nop no operation or or operation a = a + m a m n z pop pop from the stack pop reg reg m pop cc cc m h i n z c push push onto the stack push y m reg, cc rcf reset carry flag c = 0 0 ret subroutine return rim enable interrupts i = 0 0 rlc rotate left true c c <= dst <= c reg, m n z c rrc rotate right true c c => dst => c reg, m n z c rsp reset stack pointer s = max allowed sbc subtract with carry a = a - m - c a m n z c scf set carry flag c = 1 1 sim disable interrupts i = 1 1 sla shift left arithmetic c <= dst <= 0 reg, m n z c sll shift left logic c <= dst <= 0 reg, m n z c srl shift right logic 0 => dst => c reg, m 0 z c sra shift right arithmetic dst7 => dst => c reg, m n z c sub subtraction a = a - m a m n z c swap swap nibbles dst[7..4] <=> dst[3..0] reg, m n z tnz test for neg & zero tnz lbl1 n z trap s/w trap s/w interrupt 1 wfi wait for interrupt 0 xor exclusive or a = a xor m a m n z 86
87/101 st72e311 st72t311 7 electrical characteristics 7.1 absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, how- ever it is advisable to take normal precaution to avoid application of any voltage higher than the specified maximum rated voltages. for proper operation it is recommended that v i and v o be higher than v ss and lower than v dd . reliability is enhanced if unused inputs are con- nected to an appropriate logic voltage level (v dd or v ss ). power considerations .the average chip-junc- tion temperature, t j , in celsius can be obtained from: t j =ta + pd x rthja where: t a = ambient temperature. rthja = package thermal resistance (junction-to ambient). p d = p int + p port . p int =i dd x v dd (chip internal power). p port =port power dissipation determined by the user) note: stresses above those listed as absolute maximum ratings may cause permanent damage to the device. this is a stress rating only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. symbol parameter value unit v dd digital supply voltage -0.3 to 6.0 v v dda analog supply and reference voltage v dd - 0.3 to v dd + 0.3 v v i input voltage v ss - 0.3 to v dd + 0.3 v v ai analog input voltage (a/d converter) v ss - 0.3 to v dd + 0.3 v ssa -0.3 to v dda +0.3 v v o output voltage v ss - 0.3 to v dd + 0.3 v iv dd total current into v dd (source) 100 ma iv ss total current out of v ss (sink) 100 ma t j junction temperature 150 c t stg storage temperature -60 to 150 c 87
88/101 st72e311 st72t311 7.2 recommended operating conditions note 1) a safe reset (with low voltage detector option) is not guaranteed at 16 mhz. 2) a/d operation and oscillator start-up are not guaranteed below 1mhz. figure 45. maximum operating frequency (f osc ) versus supply voltage (v dd ) symbol parameter test conditions value unit min. typ. max. t a operating temperature 1 suffix version 0 70 c 6 suffix version -40 85 c 3 suffix version -40 125 c v dd operating supply voltage f osc = 16 mhz (1 & 6 suffix) f osc = 8 mhz 3.5 1) 3.0 5.5 5.5 v f osc oscillator frequency v dd = 3.0v v dd = 3.5v (1 & 6 suffix) 0 2) 0 2) 8 16 mhz f osc [mhz] supplly voltage [v] 16 8 4 1 0 2.5 3 3.5 4 4.5 5 5.5 6 functionality not guaranteed in this area functionality not guaranteed in this area with resonator functionality guaranteed in this area functionality not guaranteed in this area for temperature higher than 85c 88
89/101 st72e311 st72t311 7.3 dc electrical characteristics (t a = -40c to +125c and v dd = 5v unless otherwise specified) notes: 1. hysteresis voltage between switching levels. based on characterisation results, not tested. 2. cpu running with memory access, no dc load or activity on i/os; clock input (oscin) driven by external square wave. 3. no dc load or activity on i/os; clock input (oscin) driven by external square wave. 4. except oscin and oscout 5. wait mode with slow mode selected. based on characterisation results, not tested. symbol parameter test conditions value unit min. typ. max. v il input low level voltage all input pins 3v < v dd < 5.5v v dd x 0.3 v v ih input high level voltage all input pins 3v < v dd < 5.5v v dd x 0.7 v v hys hysteresis voltage 1) all input pins 400 mv v ol low level output voltage all output pins i ol = +10a i ol = + 2ma 0.1 0.4 v low level output voltage high sink i/o pins i ol = +10a i ol = +10ma i ol = + 15ma i ol = + 20ma, t a = 85c max 0.1 1.5 3.0 3.0 v oh high level output voltage all output pins i oh = - 10a i oh = - 2ma 4.9 4.2 v i il i ih input leakage current all input pins but reset 4) v in = v ss (no pull-up configured) v in = v dd 0.1 1.0 m a i ih input leakage current reset pin v in = v dd 0.1 1.0 r on reset weak pull-up r on v in > v ih v in < v il 20 60 40 120 80 240 k w r pu i/o weak pull-up r pu v in < v il 100 k w i dd supply current in run mode 2) f osc = 4 mhz, f cpu = 2 mhz f osc = 8 mhz, f cpu = 4 mhz f osc = 16 mhz, f cpu = 8 mhz 3.5 6 11 7 12 20 ma supply current in slow mode 2) f osc = 4 mhz, f cpu = 125 khz f osc = 8 mhz, f cpu = 250 khz f osc = 16 mhz, f cpu = 500 khz 1.5 2.5 4.5 3 5 9 ma supply current in wait mode 3) f osc = 4mhz, f cpu = 2mhz f osc = 8mhz, f cpu = 4 mhz f osc = 16mhz, f cpu = 8 mhz 2 4 6.5 4 8 12 ma supply current in wait- minimum mode 5) f osc = 4 mhz, f cpu = 125 khz f osc = 8 mhz, f cpu = 250 khz f osc = 16 mhz, f cpu = 500 khz 0.8 1 1.6 1.5 2 3.5 ma supply current in halt mode i load = 0ma without lvd, t a = 85c max i load = 0ma without lvd i load = 0ma with lvd 1 5 70 10 20 100 m a 89
90/101 st72e311 st72t311 7.4 reset characteristics (t a =-40...+125 o c and v dd =5v10% unless otherwise specified. note: 1) these values given only as design guidelines and are not tested. 7.5 oscillator characteristics (t a = -40c to +125c unless otherwise specified) 7.6 peripheral characteristics notes: 1. the safe reset cannot be guaranted by the lvd when fosc is greater than 8mhz. 2. based on characterisation results, not tested. symbol parameter conditions min typ 1) max unit r on reset weak pull-up r on v in > v ih v in < v il 20 60 40 120 80 240 k w t reset pulse duration generated by watch- dog and por reset 1 m s t pulse minimum pulse duration to be ap- plied on external reset pin 10 1) ns symbol parameter test conditions value unit min. typ. max. g m oscillator transconductance 2 9 ma/v f osc crystal frequency 1 16 mhz t start osc. start up time v dd = 5v10% 50 ms low voltage detection reset electrical specifications (option) symbol parameter conditions min. typ. max. unit v lvdup lvd reset trigger, v dd rising edge f osc = 8 mhz max 1) . 3.6 2) 3.85 4.1 v v lvddown lvd reset trigger, v dd falling edge 3.35 3.6 3.85 v v lvdhys lvd reset trigger, hysteresis 2) 250 mv 90
91/101 st72e311 st72t311 peripheral characteristics (contd) (t a = -40c to +125c and v dd = 5v10% unless otherwise specified ) *note : adc accuracy vs. negative injection current : for i inj- =0.8ma, the typical leakage induced inside the die is 1.6a and the effect on the adc accuracy is a loss of 1 lsb by 10k w increase of the external analog source impedance. these measurements results and recommendations take worst case injection conditions into account: - negative injection - injection to an input with analog capability, adjacent to the enabled analog input - at 5v v dd supply, and worst case temperature. a/d converter specifications symbol parameter conditions min typ max unit t sample sample duration 31.5 1/f cpu res adc resolution f cpu =8mhz v dd =v dda =5v 8 bit dle differential linearity error* 0.6 1 ile integral linearity error* 2 v ain analog input voltage v ssa v dda v i adc supply current rise during a/d conversion f cpu =8mhz v dd =v dda =5v 1ma t stab stabilization time after adc enable 30 s t conv conversion time 8 64 s 1/f cpu r ain resistance of analog sources (v ain) f cpu =8mhz, t=25c, v dd =v dda =5v 15 kw c hold hold capacitance 22 pf r ss resistance of sampling switch and internal trace 2 kw px.x/ainx r ain v ain c pin 5pf v dd v t = 0.6v leakage max. v t = 0.6v c pin v t leakage c hold ss sampling switch ss r ss at the pin due to various junctions c hold 22 pf capacitance = input capacitance = threshold voltage = sampling switch = sample/hold 1a v ss = leakage current 2 kw 91
92/101 st72e311 st72t311 peripheral characteristics (contd) figure 46. adc conversion characteristics (2) ( 1) (3) (4) (5) vr02133a offset error ose offset error ose gain error ge 1 lsb (ideal) 1lsb ideal v refp v refm C 256 --------------------------------------- - = v in(a) (lsb ideal ) (1) example of an actual transfer curve (2) the ideal transfer curve (3) differential non-linearity error (dle) (4) integral non-linearity error (ile) (5) center of a step of the actual transfer curve code out 255 254 253 252 251 250 5 4 3 2 1 0 7 6 1 2 3 4 5 6 7 250 251 252 253 254 255 256
93/101 st72e311 st72t311 peripheral characteristics (contd) measurement points are v ol , v oh , v il and v ih in the spi timing diagram figure 47. spi master timing diagram cpha=0, cpol=0 serial peripheral interface ref. symbol parameter condition value unit min. max. f spi spi frequency master slave 1/128 dc 1/4 1/2 f cpu 1t spi spi clock periode master slave 4 2 t cpu 2t lead enable lead time slave 120 ns 3t lag enable lag time slave 120 ns 4t spi_h clock (sck) high time master slave 100 90 ns 5t spi_l clock (sck) low time master slave 100 90 ns 6t su data set-up time master slave 100 100 ns 7t h data hold time (inputs) master slave 100 100 ns 8t a access time (time to data active from high impedance state) slave 0 120 ns 9t dis disable time (hold time to high im- pedance state) 240 ns 10 t v data valid master (before capture edge) slave (after enable edge) 0.25 120 t cpu ns 11 t hold data hold time (outputs) master (before capture edge) slave (after enable edge) 0.25 0 t cpu ns 12 t rise rise time (20% v dd to 70% v dd , c l = 200pf) outputs: sck,mosi,miso inputs: sck,mosi,miso,ss 100 100 ns m s 13 t fall fall time (70% v dd to 20% v dd , c l = 200pf) outputs: sck,mosi,miso inputs: sck,mosi,miso,ss 100 100 ns m s 1 6 7 10 11 12 13 ss (input) sck (output) miso mosi (input) (output) 4 5 d7-out d6-out d0-out d7-in d6-in d0-in vr000109
94/101 st72e311 st72t311 peripheral characteristics (contd) measurement points are v ol , v oh , v il and v ih in the spi timing diagram figure 48. spi master timing diagram cpha=0, cpol=1 figure 49. spi master timing diagram cpha=1, cpol=0 figure 50. spi master timing diagram cpha=1, cpol=1 1 6 7 10 11 12 13 ss (input) sck (output) miso mosi (input) (output) 4 5 vr000110 d7-out d6-out d0-out d7-in d6-in d0-in 1 6 7 10 11 12 13 ss (input) sck (output) miso mosi (input) (output) 5 4 vr000107 d7-in d6-in d0-in d7-out d6-out d0-out 1 6 7 10 11 12 13 ss (input) sck (output) miso mosi (input) (output) 4 5 vr000108 d7-out d6-out d0-out d7-in d6-in d0-in
95/101 st72e311 st72t311 peripheral characteristics (contd) measurement points are v ol , v oh , v il and v ih in the spi timing diagram figure 51. spi slave timing diagram cpha=0, cpol=0 figure 52. spi slave timing diagram cpha=0, cpol=1 figure 53. spi slave timing diagram cpha=1, cpol=0 figure 54. spi slave timing diagram cpha=1, cpol=1 1 6 7 10 11 12 13 ss (input) sck miso mosi (input) (output) 5 4 (input) 2 3 8 9 high-z vr000113 d7-in d6-in d0-in d7-out d6-out d0-out 1 6 7 10 11 12 13 ss (input) sck miso mosi (input) (output) 5 4 (input) 2 3 8 9 high-z vr000114 d7-in d6-in d0-in d7-out d6-out d0-out 1 6 7 10 11 12 13 ss (input) sck miso mosi (input) (output) 5 4 (input) 2 3 8 9 high-z vr000111 d7-out d6-out d0-out d7-in d6-in d0-in 1 6 7 10 11 12 13 ss (input) sck miso mosi (input) (output) 54 (input) 2 3 8 9 high-z d7-out d6-out d0-out d7-in d6-in d0-in vr000112
96/101 st72e311 st72t311 8 general information 8.1 eprom erasure eprom version devices are erased by exposure to high intensity uv light admitted through the transparent window. this exposure discharges the floating gate to its initial state through induced photo current. it is recommended that the eprom devices be kept out of direct sunlight, since the uv content of sunlight can be sufficient to cause functional fail- ure. extended exposure to room level fluorescent lighting may also cause erasure. an opaque coating (paint, tape, label, etc...) should be placed over the package window if the product is to be operated under these lighting con- ditions. covering the window also reduces i dd in power-saving modes due to photo-diode leakage currents. an ultraviolet source of wave length 2537 ? yield- ing a total integrated dosage of 15 watt-sec/cm 2 is required to erase the device. it will be erased in 15 to 20 minutes if such a uv lamp with a 12mw/cm 2 power rating is placed 1 inch from the device win- dow without any interposed filters.
97/101 st72e311 st72t311 8.2 package mechanical data figure 55. 42-pin plastic dual in-line package, shrink 600-mil width figure 56. 42-pin shrink ceramic dual in-line package, 600-mil width dim. mm inches min typ max min typ max a 5.08 0.200 a1 0.51 0.020 a2 3.05 3.81 4.57 0.120 0.150 0.180 b 0.38 0.46 0.56 0.015 0.018 0.022 b2 0.89 1.02 1.14 0.035 0.040 0.045 c 0.23 0.25 0.38 0.009 0.010 0.015 d 36.58 36.83 37.08 1.440 1.450 1.460 e 15.24 16.00 0.600 0.630 e1 12.70 13.72 14.48 0.500 0.540 0.570 e 1.78 0.070 ea 15.24 0.600 eb 18.54 0.730 ec 1.52 0.000 0.060 l 2.54 3.30 3.56 0.100 0.130 0.140 number of pins n 42 e e1 ea eb e 0.015 gage plane ec eb d e b b2 a2 a1 c l a dim. mm inches min typ max min typ max a 4.01 0.158 a1 0.76 0.030 b 0.38 0.46 0.56 0.015 0.018 0.022 b1 0.76 0.89 1.02 0.030 0.035 0.040 c 0.23 0.25 0.38 0.009 0.010 0.015 d 36.68 37.34 38.00 1.444 1.470 1.496 d1 35.56 1.400 e1 14.48 14.99 15.49 0.570 0.590 0.610 e 1.78 0.070 g 14.12 14.38 14.63 0.556 0.566 0.576 g1 18.69 18.95 19.20 0.736 0.746 0.756 g2 1.14 0.045 g3 11.05 11.30 11.56 0.435 0.445 0.455 g4 15.11 15.37 15.62 0.595 0.605 0.615 l 2.92 5.08 0.115 0.200 s 0.89 0.035 number of pins n42 cdip42sw
98/101 st72e311 st72t311 figure 57. 56-pin plastic dual in-line package, shrink 600-mil width figure 58. 56-pin shrink ceramic dual in-line package, 600-mil width dim. mm inches min typ max min typ max a 6.35 0.250 a1 0.38 0.015 a2 3.18 4.95 0.125 0.195 b 0.41 0.016 b2 0.89 0.035 c 0.20 0.38 0.008 0.015 d 50.29 53.21 1.980 2.095 e 15.01 0.591 e1 12.32 14.73 0.485 0.580 e 1.78 0.070 ea 15.24 0.600 eb 17.78 0.700 l 2.92 5.08 0.115 0.200 number of pins n 56 e 0.015 gage plane eb eb ea e1 e c a a2 a1 e b b2 d e b dim. mm inches min typ max min typ max a 4.17 0.164 a1 0.76 0.030 b 0.38 0.46 0.56 0.015 0.018 0.022 b1 0.76 0.89 1.02 0.030 0.035 0.040 c 0.23 0.25 0.38 0.009 0.010 0.015 d 50.04 50.80 51.56 1.970 2.000 2.030 d1 48.01 1.890 e1 14.48 14.99 15.49 0.570 0.590 0.610 e 1.78 0.070 g 14.12 14.38 14.63 0.556 0.566 0.576 g1 18.69 18.95 19.20 0.736 0.746 0.756 g2 1.14 0.045 g3 11.05 11.30 11.56 0.435 0.445 0.455 g4 15.11 15.37 15.62 0.595 0.605 0.615 l 2.92 5.08 0.115 0.200 s 1.40 0.055 number of pins n56 cdip56sw
99/101 st72e311 st72t311 figure 59. 64-pin thin quad flat package figure 60. 44-pin thin quad flat package dim. mm inches min typ max min typ max a 1.60 0.063 a1 0.05 0.15 0.002 0.006 a2 1.35 1.40 1.45 0.053 0.055 0.057 b 0.30 0.37 0.45 0.012 0.015 0.018 c 0.09 0.20 0.004 0.008 d 16.00 0.630 d1 14.00 0.551 e 16.00 0.630 e1 14.00 0.551 e 0.80 0.031 q 0 3.5 7 0 3.5 7 l 0.45 0.60 0.75 0.018 0.024 0.030 l1 1.00 0.039 number of pins n 64 c h l l1 e b a a1 a2 e e1 d d1 dim. mm inches min typ max min typ max a 1.60 0.063 a1 0.05 0.15 0.002 0.006 a2 1.35 1.40 1.45 0.053 0.055 0.057 b 0.30 0.37 0.45 0.012 0.015 0.018 c 0.09 0.20 0.004 0.000 0.008 d 12.00 0.472 d1 10.00 0.394 e 12.00 0.472 e1 10.00 0.394 e 0.80 0.031 q 0 3.5 7 0 3.5 7 l 0.45 0.60 0.75 0.018 0.024 0.030 l1 1.00 0.039 number of pins n 44 a a2 a1 b e l1 l h c e e1 d d1
100/101 st72e311 st72t311 8.3 ordering information each device is available for production in user pro- grammable version (otp). otp devices are shipped to customer with a default blank content ffh. there is one common eprom version for debugging and prototyping which features the maximum memory size and peripherals of the family. care must be taken to only use resources available on the target device. figure 61. otp user programmable device types notes: C the st72e311j4d0/st72e311n4d0 (cerdip 25 c) are used as the eprom versions for the above devices. C the rom versions are supported by the st72314 family. device package temp. range s= lvd reset option 3 = automotive -40 to +125c 6= industrial -40 to +85 c b= plastic dip t= plastic tqfp st72t311j2 st72t311j4 st72t311n2 st72t311n4 x
101/101 st72e311 st72t311 9 summary of changes information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 2001 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - china - finland - france - germany - hong kong - india - italy - japan - malaysia - malta - morocco - sin gapore - spain sweden - switzerland - united kingdom - u.s.a. http://www.st.com change description (rev. 1.5 to 1.6) page added new external connections section 10 removed rp external resistor 18 changed ored to anded in external interrupts paragraph, to read if several input pins, con- nected to the same interrupt vector, are configured as interrupts, their signals are logically an- ded before entering the edge/level detection block. 21 and 27 added note any modification of one of these two bits resets the interrupt request related to this interrupt vector. 26 added clamping diodes to i/o pin figure and table 29 added sections on low power modes and interrupts to peripheral descriptions 34, 47, 60, 74, 79 changed 16-bit timer chapter 36 to 52 added details to description of folv1 and folv2 bits 48 added adc recommended external connections 79 added reset characteristics section 90 added min. value for v lvdup 90 added figure to adc converter specification 91 removed st72311 rom device (supported by st72314) change description (rev. 1.6 to 1.7) spr2 bit reinstated in spi chapter 64 to 76 change description (rev. 1.7 to 1.8) of 31 may 2001 spi frequency changed from f cpu /2 to f cpu /4 in table 18 75


▲Up To Search▲   

 
Price & Availability of ST72T311J4B3S

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X